Creating a ticket: Why a 400 Bad Request?
|
|
I’m trying to create a ticket using the API. Even though a summary and priority are being specified, I’m receiving a 400 Bad Request response stating that priority and summary must be set. Request: POST /api/v1/projects/1/tickets HTTP/1.1 <?xml version=“1.0”??>43Testing summaryThis is a test description Response: HTTP/1.1 400 Bad Request <?xml version=“1.0” encoding=“UTF-8”??>Priority can only be one of the following: 5, 4, 3, 2, 1Summary can’t be blank Any ideas why this error is occurring even though the things it’s complaining about are set in the request’s entity body? |
|
|
Thanks for providing such a detailed example. It was helpful in determining the source of your error. You will notice that your request contains a header “Content-Type: application/x-www-form-urlencoded”. However, you are attempting to post XML. As such, your Content-Type header should rather be “application/xml”. If you change that you should find that the ticket creation happens without any problems. |
|
|
Thanks for your assistance, Joshua. I guess I just overlooked the Content-Type header. I’ll give that a shot and post back if I have any problems. Thanks! -Michael |
