Functions · operationId:PutFunction

Update a Function

PUT /v1/functions/{functionId}

Description

Updates the name or projectId of a Function. Input and output modality cannot be changed after creation.

Path parameters

NameTypeRequiredDescription
functionId string yes

Request body

Content type: application/json. Body schema: WritableFunction.

Responses

StatusDescriptionBody
200 Success Function

Code samples

curl
curl -X PUT \
  -H 'Authorization: Bearer <accessToken>' \
  -H 'Content-Type: application/json' \
  -d '{
  "projectId": "string",
  "name": "my-label",
  "input": "Text",
  "output": "Classification"
}' \
  'https://www.nyckel.com/v1/functions/<functionId>'
Python
import requests

url = 'https://www.nyckel.com/v1/functions/<functionId>'
headers = {
    'Authorization': 'Bearer <accessToken>',
    'Content-Type': 'application/json',
}

body = """{
  "projectId": "string",
  "name": "my-label",
  "input": "Text",
  "output": "Classification"
}"""
response = requests.put(url, headers=headers, data=body)
print(response.json())
JavaScript
fetch('https://www.nyckel.com/v1/functions/<functionId>', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer <accessToken>',
    'Content-Type': 'application/json',
  },
  body: `{
  "projectId": "string",
  "name": "my-label",
  "input": "Text",
  "output": "Classification"
}`,
})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://www.nyckel.com/v1/functions/<functionId>');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');

$headers = array(
    'Authorization: Bearer <accessToken>',
    'Content-Type: application/json',
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$body = <<<'NYCKEL_BODY'
{
  "projectId": "string",
  "name": "my-label",
  "input": "Text",
  "output": "Classification"
}
NYCKEL_BODY;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);
curl_close($ch);
echo $response;