Hi there,
I am facing a pretty frustrating issue when using the Jira Service Desk REST API. In my specific case, when i use the temporary file upload endpoint as documented here:
It returns a 404 which indicates the service desk does not exit.
I have supplied a valid serviceDeskId of 2 which exists in the system and alternatively, I have tried specifying it using the Project Identifier (https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#project-identifiers) recognised formats such as using ProjectId or ProjectKey instead of serviceDeskId. But to no avail.
The authorization header that I use is valid and has been tested against other REST API endpoints. I have issues with the following calls only - as tested so far.
POST /rest/servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile
and
DELETE /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer
The base64 encoded username and API key used as Authorization header is that of a user who has administrative credentials with the associated service desk / project key / project Id.
As per the documentation if user permissions were an issue, I would have received 403. So, I am not sure why Jira Service Desk REST API returns a weird 404 response when the serviceDeskId exists!
Any help is appreciated.
I found out the issue. I provided the following HTTP header outside of the headers object in my nodejs fetch() call.
'X-ExperimentalApi': 'opt-in',
'X-Atlassian-Token': 'no-check',
The above should be part of the headers object and it was clear oversight from my end.
NOTE: The HTTP header X-Experimental-Api was renamed as X-ExperimentalApi as well.
Could you maybe do a GET first to see what it returns?
GET /rest/servicedeskapi/servicedesk
seems like a good idea to start :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Dirk Ronsmans for your response. I have tried that earlier and it returns the available service desks in our setup. I can see the returned servicedesk Id, project Id, project Key, project Name in the returned JSON structure.
I am wondering why I get a 404 when I use the Id field associated with the servicedesk which I got from the specified GET call.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you maybe provide us with an example json payload? and the url you are using? Might be that we see something there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Example of get queues based on supplied serviceDeskId (works):
fetch(
"orgname.atlassian.net/rest/servicedeskapi/servicedesk/2/queue?limit=10",
{
method: 'get',
headers: {
Authorization: "Basic Base64EncodedString",
'Content-Type': 'application/json'
},
}).then(res => res.json())
.then(json => console.log(json.values));
The above returns a valid response of queues with the specified serviceDeskId (i.e. 2).
The following example (fails by returning 404):
fetch(
"orgname.atlassian.net/rest/servicedeskapi/servicedesk/2/attachTemporaryFile",
{
method: 'POST',
'X-ExperimentalApi': 'opt-in',
'X-Atlassian-Token': 'no-check',
headers: {
Authorization: "Basic Base64EncodedString",
Accept: 'application/json'
},
body: { file: BlobContent }
}).then(res => res.json())
.then(json => console.log(json));
I am making use of node-fetch (https://www.npmjs.com/package/node-fetch) Node JS library.
FYI, when I played with the /servicedesk/2/attachTemporaryFile endpoint, I initially received 415 response which indicated that the content-type that I identified was incorrect and after fixing the error, I am now getting 404 which indicates that the servicedesk Id (i.e. 2) does not exists - which is incorrect.
Bear with the poor code block formatting. I wish Atlassian could have a better rich-text editor here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.