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.
https://mapi.storyblok.com/v1/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
-
collaborator
The Collaborator Object-
role
stringRole of the collaborator, could be admin, editor or custom roles
-
user_id
numberNumeric 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
-
space_role_ids
number[]Array of space role ids
-
Request
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}}"
Request
// 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)
})
Request
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
$payload = [
"collaborator" => [
"role" => 49707,
"space_role_id" => 49707
]
];
$client->put('/spaces/656/collaborators/2362', $payload)->getBody();
Request
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)
Request
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();
Request
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);
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()
Request
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)