Update a Project Member - Cognigy Documentation
Update a Project Member
PATCH /v2.0/projects/{projectId}/members/{userId}
Use this endpoint to update a project member's allowed locales.
Request Example
curl --request PATCH \
--url https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/members/{userId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"allowedLocales": [
{
"localeId": "<string>"
}
]
}'
Python Example
import requests
url = "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/members/{userId}"
payload = { "allowedLocales": [{ "localeId": "<string>" }] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch) Example
const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({allowedLocales: [{localeId: '<string>'}]})
};
fetch('https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/members/{userId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP Example
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/members/{userId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'allowedLocales' => [
[
'localeId' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Response Codes
- 204: Project member was updated successfully.
- 400: Bad Request.
- 401: Unauthorized Error.
- 402: Payment Required.
- 403: Forbidden Error.
- 404: Not Found Error.
- 500: Internal Server Error.
Authorization
- X-API-Key: Supply the API Key in the HTTP-Header.
Body Parameters
- allowedLocales: List of allowed locales.
Path Parameters
- projectId: The unique identifier for the Project.
- userId: The Id of the User.