[Solved] Problem with creating issue (types)

I’m trying to create Issue through the API, but I’m not getting it.

I execute the command:

curl -X POST “https://SPACEID.backlog.com/api/v2/projects/52110/issueTypes?apiKey=MYKEY” --header “Content-Type: application/json;charset=utf-8” --data @issue.json

This is my file JSON:

[{“name”:“Bug”,“color”: “#990000”,“templateSummary”:“Subject”,“templateDescription”:“Description”}]

You can help me?

Thanks very much.

Regards,

1 Like

Hi @fernandodomenike
Welcome to our community!

I’m sorry, I’m not very familiar with using our API, but I’ve forwarded your question to our developers for further advice.

In the meantime, I think you have seen the API documentation, but just in case, here’s the section on adding issues.

Perhaps it might be the URL, it’s from the documentation for adding issues:

/api/v2/issues 

Can you try using the URL as https://fedomenike.backlog.com/api/v2/issues?apiKey=MYKEY instead?

Because if you were making a test request to the below

https://xx.backlog.com/api/v2/users/myself?apiKey=abcdefghijklmn 

you should get a positive 200 response. ( Not forgetting to swap in your own Backlog domain and apiKey in the above URL.)

So I suspect it’s the URL endpoint. Because it’s different URL endpoints for different requests: adding issues, get user, get project, etc.

For the JSON form parameters in the adding issues request, there are also some required parameters like projectId, summary, etc., listed in the documentation.

Perhaps you can try using an online API request builder too, for example, Hoppscotch (https://hoppscotch.io/) because it might be easier for API testing purposes.

A post was split to a new topic: How to add issues using Backlog API

Hi @fernandodomenike

I apologize, I realized you were asking how to “add issue type”, not “add issue”. :sweat_smile: I’ve edited the post title above.

I understand that our support team has replied to your question. But just to share with other Backlog API users:

The form parameters (for the header) for adding issue type via API is

Content-Type:application/x-www-form-urlencoded 

That’s why the initial curl request failed. Changing it should work now.

We hope you’ll continue to enjoy development using the Backlog API. Thank you for your support!

Soohian, good evening.

Jenny, thank you so much for your help.
You can create Issues.

This my command:

curl -k -X POST “https://SPACEID.backlog.com/api/v2/issues?apiKey=APIKEY HIDDEN” --header “Content-Type: application/json;charset=utf-8” --data @issues.json

It’s work. :wink:

Thanks a lot for the help.

Regards,

1 Like

@fernandodomenike
Thank you!
Glad to hear it works :+1: :grinning: