How to handle "text" type responses in Imports?

I am using the integrator.io State REST API to populate state information in an integration. I have an Import that calls the below API Endpoint with the state data.

PUT /v1/integrations/<integration-id>/state/myState HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token

 I receive a "text" type response with the word "OK" from the above API call. Since the integrator does not support response formats other than application/json, the above Import always logs the below error.

An invalid JSON is sent in the response.body, error: please ensure that you have wrapped all JSON property names in quotes. details: Unexpected token O in JSON at position 0

What is the proper solution for the above issue? How can I get rid of the error message? I know that I can use a postResponse hook function and silently ignore the error. But I feel the platform should support textual responses since these are standard response patterns.  

3

Comments

3 comments
Date Votes
  • Zanfer Hussain we currently don't support plain text for responses, but do have it on the roadmap (yes I get the irony here). Your idea on using a postSubmit function is what I would do. Additionally, and what we've done internally sometimes, is create a myAPI that handles getting, deleting, and updating states and then can handle sending back valid json to the flow itself.

    1
  • Thanks, Tyler Lamparter for the response and apologies for the late follow-up. I just wanted to check whether you have planned this fix for a future release?

    0
  • Zanfer Hussain sorry for the delayed response here. We do have it on the roadmap and are hoping to make it available early next year.

    As another work around, you could use the generic HTTP endpoint with integrator.io, then override the successful media type to CSV. In that case, we will parse the plain text as if it was a CSV and you then wouldn't get this error or need a script to ignore it.

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post