Fields ·
operationId:PutField
Update a Field
PUT
/v1/functions/{functionId}/fields/{fieldId}
Description
Update field
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
functionId |
string |
yes | — |
fieldId |
string |
yes | — |
Request body
Content type: application/json.
Body schema: WritableField.
Responses
| Status | Description | Body |
|---|---|---|
200 |
Success | Field |
Code samples
curl
curl -X PUT \
-H 'Authorization: Bearer <accessToken>' \
-H 'Content-Type: application/json' \
-d '{
"name": "my-label",
"type": "Text"
}' \
'https://www.nyckel.com/v1/functions/<functionId>/fields/<fieldId>'
Python
import requests
url = 'https://www.nyckel.com/v1/functions/<functionId>/fields/<fieldId>'
headers = {
'Authorization': 'Bearer <accessToken>',
'Content-Type': 'application/json',
}
body = """{
"name": "my-label",
"type": "Text"
}"""
response = requests.put(url, headers=headers, data=body)
print(response.json())
JavaScript
fetch('https://www.nyckel.com/v1/functions/<functionId>/fields/<fieldId>', {
method: 'PUT',
headers: {
'Authorization': 'Bearer <accessToken>',
'Content-Type': 'application/json',
},
body: `{
"name": "my-label",
"type": "Text"
}`,
})
.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>/fields/<fieldId>');
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'
{
"name": "my-label",
"type": "Text"
}
NYCKEL_BODY;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Related
Source of truth: /openapi/v1.json