Rest api, create new org admin, read only without network and tags

woonder2020
Conversationalist

Rest api, create new org admin, read only without network and tags

Dear all, 

 

i want to create a new organisation admin by using  rest api,

user read only without network and tags,

 

but i get an http error 400 every time, if the tag is empty

example from cisco:

 

 

 

{ "id": "212406", "name": "Miles Meraki",

"email": "miles@meraki.com",

"orgAccess": "none", "accountStatus": "ok",

"twoFactorAuthEnabled": false,

"hasApiKey": true,

"lastActive": "2019-01-28 14:58:56 -0800",

 

   >>>>    "tags": [ { "tag": "west", "access": "read-only" } ],    <<<<<<

 

"networks": [ { "id": "N_24329156", "access": "full" }

 

 

Is this even possible ?

 

greetings ob

 

5 REPLIES 5
PhilipDAth
Kind of a big deal
Kind of a big deal

What does your request look like?

Hi,

 

we use Servicenow and the rest api within Servicenow,

 

here is the body of a message:

 

{
"name":"billy test",
"email": "billy.test@testdomain.com",
"orgAccess":"read-only",
"tags": [{ "tag": "[]", "access": "read-only" }]
}
httpStatus: 201
responseBody: "{\"id\":\"1234976994152198008\",\"name\":\"Billy Test\",\"email\":\"billy.test@testdomain.com\",\"authenticationMethod\":\"Email\",\"orgAccess\":\"read-only\",\"accountStatus\":\"unverified\",\"twoFactorAuthEnabled\":false,\"hasApiKey\":false,\"lastActive\":\"\",\"networks\":[],\"tags\":[{\"tag\":\"[]\",\"access\":\"read-only\"}]}"
User Billy Test has been created successfully

 

This works, but i have these 2 sqaure brackets in the dashboard after creation of the account, 

 

if the code looks like this:

 

"tags": [{ "tag": "", "access": "read-only" }]

 

i will get error 400 and the new adminwas not created

Try changing from:

"tags": [{ "tag": "[]", "access": "read-only" }]

to:

"tags": [{ "tag": "", "access": "read-only" }]

Using JSONlint.com can help identify issues.

 

 

{
	"name": "billy test",
	"email": "billy.test@testdomain.com",
	"orgAccess": "read-only",
	"tags": [{
		"tag": "[]",
		"access": "read-only"
	}]
}

 

Did you intend to try to tag the user with a tag that is simply square brackets?

 

How's it go if you leave out the tags param entirely? Only email, name and orgAccess are required.

Hi everbody,

 

i tried all your tips before, but everytime i will got the error 400,

 

but i found a workaround;

 

 i deleted tags complety in the content, now it works with the message 201 and the result in the dashboard is as excepted.

 

thank you for your help, 

 

greetings

Get notified when there are additional replies to this discussion.