Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

unable to get properties keys via the JSD REST API

Henk Smets September 17, 2019

I'm unable to get the property keys for organisations

I assume it has something to do with permissions because all other requests work and the type of request has a remark about restrictions.

Note: Permission to manage organizations can be switched to users with the Jira administrator permission, using the Organization management feature.

on: https://developer.atlassian.com/cloud/jira/service-desk/rest/?_ga=2.17854969.1935148421.1568713427-335750297.1568189270#api-rest-servicedeskapi-organization-organizationId-property-get

I authenticate with basic authentication and a user with site admin permissions, which is also a member of the organisation for which I would like to get the property keys, a project admin and a service desk agent of the SD-project.

GET https://vlaamseoverheid.atlassian.net/rest/servicedeskapi/organization/12/property

response:

{
"keys": []
}

1 answer

0 votes
Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 18, 2019

Hi Henk,

I tested the same API after trying to add a property key, but I receive the same response.

Also, I searched for bugs and similar cases but didn’t find anything that could help us.

Just for us to better understand, were you able to set a property with this API? Did it show any error or any other message?

I’m checking with the team responsible for that and once I have a response, I’ll post here.

Regards,
Angélica

Henk Smets September 19, 2019

No, I cannot set a property for one of our organisations with the same API. But I'm not sure if I'm using the right property-key ... When I try:

PUT: https://vlaamseoverheid.atlassian.net/rest/servicedeskapi/organization/12/property/name

and a key "name" with a value "name" in the header, I get a 400:

{
"errors": {},
"errorMessages": [
"De eigenschapswaarde kan niet leeg zijn."
],
"httpStatusCode": {
"present": true
}
}

I'm able to get the list of our organisations with this: https://vlaamseoverheid.atlassian.net/rest/servicedeskapi/organization

Other requests also work: 

https://your-domain.atlassian.net/rest/servicedeskapi/organization/{organizationId}/user'
Andrea
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 23, 2019

Hi @Henk Smets

I'm a developer on the JSD ecosystem team.

The organization entity property API takes a JSON body and stores this as the property value.

Can you try the following call?

curl -u username:token -X PUT  -H "Content-Type: application/json" -d '{"key": "value"}' https://vlaamseoverheid.atlassian.net/rest/servicedeskapi/organization/12/property/name

When you GET all properties you should see in the `keys` field a property called "name" and if you GET the value of "name" (GET https://vlaamseoverheid.atlassian.net/rest/servicedeskapi/organization/12/property/name)

it will return a JSON object of {"key": "value"}.

Let me know if that works,

Andrea

Like Angélica Luz likes this
Brian Webb January 2, 2020

Hi Andrea. I'm not able to get this to work for my organization. Maybe my curl is different on Windows 10?

curl -u username:token -X PUT -H "Content-Type: application/json" -d '{"key":"value"}' https://avontus.atlassian.net/rest/servicedeskapi/organization/12/property/name


{"errors":{},"errorMessages":["The JSON data provided for the property is not a valid JSON: '{key:value}'."],"httpStatusCode":{"present":true}}

Thanks for your help,

Brian

Andrea
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 2, 2020

Hi @Brian Webb

You're right, I think the escaping works differently on Windows machines (i'm using a Mac). The error message seems to say that the double quote values aren't being passed so you might need to escape them first.

Can you try this?

curl -u username:token -X PUT -H "Content-Type: application/json" -d "{\"key\":\"value\"}" https://avontus.atlassian.net/rest/servicedeskapi/organization/12/property/name
Brian Webb January 2, 2020

YAY! Thank you soooo much Andrea. I totally forgot about escaping that. Phew!

Like Andrea likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events