Perl / MongoDB Atlas / Update One Organization Invitation
Back to Collection Items
use chilkat();
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
$http = chilkat::CkHttp->new();
$http->put_DigestAuth(1);
$http->put_Login("username");
$http->put_Password("password");
# Use this online tool to generate code from sample JSON: Generate Code to Create JSON
# The following JSON is sent in the request body.
# {
# "roles": [
# "ORG_OWNER"
# ],
# "username": "wyatt.smith@example.com"
# }
$json = chilkat::CkJsonObject->new();
$json->UpdateString("roles[0]","ORG_OWNER");
$json->UpdateString("username",'wyatt.smith@example.com');
$sbRequestBody = chilkat::CkStringBuilder->new();
$json->EmitSb($sbRequestBody);
# resp is a HttpResponse
$resp = $http->PTextSb("PATCH","https://domain.com/api/atlas/{{version}}/orgs/{{ORG-ID}}/invites",$sbRequestBody,"utf-8","application/json",0,0);
if ($http->get_LastMethodSuccess() == 0) {
print $http->lastErrorText() . "\r\n";
exit;
}
print $resp->get_StatusCode() . "\r\n";
print $resp->bodyStr() . "\r\n";
Curl Command
curl -X PATCH
--digest -u 'username:password'
-d '{
"roles": [
"ORG_OWNER"
],
"username": "wyatt.smith@example.com"
}'
https://domain.com/api/atlas/{{version}}/orgs/{{ORG-ID}}/invites
Postman Collection Item JSON
{
"name": "Update One Organization Invitation",
"request": {
"method": "PATCH",
"header": [
],
"body": {
"mode": "raw",
"raw": " {\n \"roles\": [\n \"ORG_OWNER\"\n ],\n \"username\": \"wyatt.smith@example.com\"\n }",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base_url}}/api/atlas/{{version}}/orgs/{{ORG-ID}}/invites",
"host": [
"{{base_url}}"
],
"path": [
"api",
"atlas",
"{{version}}",
"orgs",
"{{ORG-ID}}",
"invites"
]
},
"description": "https://docs.atlas.mongodb.com/reference/api/organization-get-all/"
},
"response": [
]
}