JSON error in multipart/form-data API

Hello,
I am facing an issue with the FreshDesk API (v2), in this case when creating a ticket:
I supply tags, but when using multipart/form-data, I get a 400 Error response with:
[{"field":"tags","message":"Value set is of type String.It should be a/an Array","code":"datatype_mismatch"}]
I have tried as a String, as a JSON array string, and as various JSON Array object types.
The trouble with It should be a/an Array
What sort of Array? There are many Arrays in the world today. Is it a Gson Array, javax.json? json.org?
The point of JSON is to allow a valid JSON string that any JSON reader can parse it.

Please note that this error is only returned when using multipart/form-data.
The same call using Content-Type=application/json (i.e. no multipart and thus no attachments) works fine - I get a 201 and a new Ticket. (in this case, I send a valid JSON array string of tags)

Is the API expecting a special format for arrayed items - e.g tags when using multipart?

Thank you,
Peter

2 Likes

Hi @Peter.

Welcome to the community! :raised_hands:

Can you share the request in CURL format or as a Postman collection? Also, arrays are passed a bit differently in multipart requests ( `key[]` : `value` format). Can you try this out ?

would result in

image

1 Like