dthangap
Contributor
Contributor

Content library creation from Rest api fails with 403 forbidden

Jump to solution

i am trying to create content library using rest api. below is my payload. 

url = https://{{vc}}/rest/com/vmware/content/local-library

payload = 

{
"create_spec": {
"name": "CL2",
"description": "CL1 Desc",
"publish_info": {
"authentication_method": "NONE",
"persist_json_enabled": false,
"published": false
},
"storage_backings": [
{
"datastore_id": "datastore-12",
"type": "DATASTORE"
}
],
"type": "LOCAL"
}
}
 
though i am able to create content library using GUI, with this request i am facing unauthorized error as below
 
{
"type": "com.vmware.vapi.std.errors.unauthorized",
"value": {
"error_type": "UNAUTHORIZED",
"messages": [
{
"args": [],
"default_message": "Permission to perform this operation was denied.",
"id": "com.vmware.vdcs.vsphere-auth-lib.permission.denied"
}
]
}
}
0 Kudos
1 Solution

Accepted Solutions
dthangap
Contributor
Contributor

the issue was with datastore id , not with the permission. i gave the datastore name, instead of id, which caused this.

the error was misleading though

View solution in original post

0 Kudos
1 Reply
dthangap
Contributor
Contributor

the issue was with datastore id , not with the permission. i gave the datastore name, instead of id, which caused this.

the error was misleading though

View solution in original post

0 Kudos