Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

When I am trying to delete assets using rest API, it gives me an internal server error(500)?

Risikanta Pradhan
Contributor
July 19, 2023

I have duplicate assets in my object schema, So I am trying to remove those assets using rest API. 

I tried using " https://api.atlassian.com/jsm/assets/workspace/{workspaceId}/v1/object/{id}" rest API but when I am sending "delete" request then it showing an error.

For reference please find the attached screenshot below.

image.png

 

1 answer

0 votes
Kai Becker
Community Champion
July 19, 2023

Hi @Risikanta Pradhan 

thanks for your question.
Would you mind sharing the request body and headers you are sending? 

Please do not post credentials.

Risikanta Pradhan
Contributor
July 19, 2023

Hi @Kai Becker 

Thanks for the reply.

I do not send any headers in the request body only follow the Jira rest API documentation for delete.

I tried using -     curl --request DELETE \ --url 'https://api.atlassian.com/jsm/assets/workspace/{workspaceId}/v1/object/{id}'

image.pngSo can you please give any idea about headers, which is help me to delete the assets through the rest API.

Kai Becker
Community Champion
July 20, 2023

hi @Risikanta Pradhan 

thanks for clarification. Did you check, that you replace the placeholders for workspace and object with the correct ids?
How do you authenticaticate when using curl? 

Could you also please paste the whole curl error here?

Risikanta Pradhan
Contributor
July 20, 2023

Hi @Kai Becker 

Thanks for the reply.

I have cross checked the workspace and object Id that are correct.

Authenticate using email and token.

This is the screenshot of error.

image.png

Regards,

Risikanta

Kai Becker
Community Champion
July 21, 2023

Hi @Risikanta Pradhan 

do you use curl on the command line or a browser / http client?
500 means server error and usually comes from wrong input, so it is essential to see everything you entered / send.

I just tried this in my demo environment and it worked without any problems:

curl --request DELETE --url 'https://api.atlassian.com/jsm/assets/workspace/{workspaceId}/v1/object/{objectId}' --header 'Accept: application/json' --user 'email:token'
Risikanta Pradhan
Contributor
July 21, 2023

Hi @Kai Becker 

I have sent as you suggested, but that not working.

image.png

Any other way to do the task.

Regards,

Risikanta

Kai Becker
Community Champion
July 21, 2023

Hi @Risikanta Pradhan 

it is kinda hard to debug your problem if you won't provide further information.

I have asked several questions, which you haven't yet answered:

  1. do you use curl on the command line or a browser / http client?
  2. You said you tried curl, so I asked: 

    How do you authenticaticate when using curl?

    Could you also please paste the whole curl error here?

Other things:

  1. You could also use the -v flag in curl to get extended output
  2. Is your request body empty?
  3. Could you please post the configuration screen of your request, as your screenshot only shows a reponse?

Without this information it is quite impossible to solve your issue.

Risikanta Pradhan
Contributor
July 21, 2023

Hi @Kai Becker 

I use Postman for now to send the delete request not the curl on the command line.

And authenticate using email and token.

The whole error is image.png

So, could you please assist me to delete the assets.

Regards,

Risikanta

Kai Becker
Community Champion
July 21, 2023

Hi @Risikanta Pradhan 

just downloaded postman entered the url from the curl command and changed to another objectId. Worked without any problems. 
For authorization I've been using basic auth with username and token.

Everything else is postman default. If this does not work for you, I would recommend to open up a support request here https://support.atlassian.com/

Risikanta Pradhan
Contributor
July 23, 2023

Hi @Kai Becker 

Thanks for reply,

I have Postman and I am using that. So I have been using basic auth with username and token for authentication.

But it does not work for me.

So I raised a request in Atlassian community.

 

Regards,

Risikanta

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events