Error 400 attaching json file

I'm using POST to "/task/<id>/attachments" to attach a file to a task.

When that file is JSON data, with content type "application/json", the response is error 400 Bad Request with the following error description:

"Parameter `<first key in json object>` is not allowed"

I can work around this by massaging the content type to be "text/plain", but it would be nice if I didn't have to add a special case for json data.

Is there json that is allowed to be posted to "/task/<id>/attachments"? What does that do?

By the way, the use case here is for bug reports. The task is a bug report, and I'm trying to attach relevant input (the json file) for recreating the issue being reported.

1 comment
Spot On Innovative Approach Stellar Advice

Michael Cornelius, let's try to fix the request. To add the JSON file via API, no additional parameters are required, but please make sure that there is the 'X-File-Name' Header and the file is added in the request Body. Do so by choosing the binary format and select the JSON file from the local storage:

Check the example Request on Wrike Developers portal and this cURL example below:

Let us know the results!😉

Lisa K. Community Team at Wrike Wrike Product Manager Become a Wrike expert with Wrike Discover

Lisa K. Wrike Team member Become a Wrike expert with Wrike Discover


Folllowing List for Post: Error 400 attaching json file
[this list is visible for admins and agents only]

Didn’t find what you were looking for? Write new post