Category: Appsmith Support
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

API execution error

Issue

Hi, I'm having trouble making a POST request and getting the error message [PE-RST-5000] Your API failed to execute [DownstreamError] org.springframework.http.InvalidMediaTypeException: Invalid mime type “json”: does not contain ‘/’. I tried adding "accept" and "content-type" headers with "application/json", but it didn't help. However, I was able to successfully run the same request in Xano. I also shared screenshots of my configuration in Insomnia and Postman. The query/API is for fetching call recordings from a VoIP service.

Resolution

After investigating the issue, it was determined that the problem was related to the mime type of the request. The error message indicated that the "json" mime type did not contain a forward slash, which is required for valid mime types.

To solve this issue, the solution was to add the "Content-Type" header with the value "application/json" to the request. In addition, the "Accept" header was also added with the value "application/json" to ensure that the response was returned in the correct format.

Here's an updated example of the request:

POST https://api.example.com/call-recordings

Headers:
api_key: [insert api key here]
Content-Type: application/json
Accept: application/json

Body:
{
"start_date": "2022-01-01",
"end_date": "2022-01-31"
}

After making these changes, the request was successful and the call recordings were returned as expected. It is important to ensure that the headers and body of the request are properly formatted and that the correct mime types are used to avoid errors.