Update a Collaborator Roles and Permissions
This endpoint is used for updating a collaborator. You can set some of the fields available in the collaborator object.
/spaces/:space_id/collaborators/:collaborator_id
Path Parameters
-
:space_id
required numberNumeric id of a space
-
:collaborator_id
required numberThe collaborator id
Request Body Properties
-
role
stringThe role name of the collaborator. It could be admin, editor, or set to a roleid. For custom roles - while adding one role, you need to set it to the
role_id
, and for adding multiple roles, you need to set the value tomulti
required -
user_id
numberUser id of the user
-
permissions
enum[]Allow specific actions for collaborator in interface and add the permission as array of strings
Permission Description publish_stories Allow publishing of content entries save_stories Allow editing and saving of content entries edit_datasources Allow editing and saving of datasources access_commerce Allow access to commerce app edit_story_slug Deny the change of slugs of content entries move_story Deny moving of content entries view_composer Deny access to visual composer -
space_role_id
numberNumeric id of the space role connected with collaborators
-
space_role_ids
number[]Array of space role ids
-
allow_multiple_roles_creation
booleanBoolean value, if
true
you can add multiple role ids for a collaborator
curl "https://mapi.storyblok.com/v1/spaces/656/collaborators/2362" \
-X PUT \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d "\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}"
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('/spaces/656/collaborators/2362', "collaborator": {
"role": 49707,
"space_role_id": 49707
})
.then(response => {
console.log(response)
}).catch(error => {
console.log(error)
})
$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
$payload = "collaborator" => [
"role" => 49707,
"space_role_id" => 49707
];
$client->put('/spaces/656/collaborators/2362', $payload)->getBody();
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
payload = "collaborator" => {
"role" => 49707,
"space_role_id" => 49707
}
client.put('/spaces/656/collaborators/2362', payload)
HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/656/collaborators/2362")
.header("Content-Type", "application/json")
.header("Authorization", "YOUR_OAUTH_TOKEN")
.body("\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}")
.asString();
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/656/collaborators/2362");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import Foundation
let headers = [
"Content-Type": "application/json",
"Authorization": "YOUR_OAUTH_TOKEN"
]
let postData = NSData(data: "\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/656/collaborators/2362")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
import requests
url = "https://mapi.storyblok.com/v1/spaces/656/collaborators/2362"
querystring = {}
payload = "\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}"
headers = {
'Content-Type': "application/json",
'Authorization': "YOUR_OAUTH_TOKEN"
}
response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)
print(response.text)