Labels ·
operationId:PostLabel
Create a Label
POST
/v1/functions/{functionId}/labels
Description
Create label
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
functionId |
string |
yes | — |
Request body
Content type: application/json.
Body schema: WritableLabel.
Responses
| Status | Description | Body |
|---|---|---|
200 |
Success | Label |
Code samples
curl
curl -X POST \
-H 'Authorization: Bearer <accessToken>' \
-H 'Content-Type: application/json' \
-d '{
"name": "my-label",
"description": "string",
"metadata": {
}
}' \
'https://www.nyckel.com/v1/functions/<functionId>/labels'
Python
import requests
url = 'https://www.nyckel.com/v1/functions/<functionId>/labels'
headers = {
'Authorization': 'Bearer <accessToken>',
'Content-Type': 'application/json',
}
body = """{
"name": "my-label",
"description": "string",
"metadata": {
}
}"""
response = requests.post(url, headers=headers, data=body)
print(response.json())
JavaScript
fetch('https://www.nyckel.com/v1/functions/<functionId>/labels', {
method: 'POST',
headers: {
'Authorization': 'Bearer <accessToken>',
'Content-Type': 'application/json',
},
body: `{
"name": "my-label",
"description": "string",
"metadata": {
}
}`,
})
.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>/labels');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
$headers = array(
'Authorization: Bearer <accessToken>',
'Content-Type: application/json',
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$body = <<<'NYCKEL_BODY'
{
"name": "my-label",
"description": "string",
"metadata": {
}
}
NYCKEL_BODY;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Related
Source of truth: /openapi/v1.json