0

I have created one salesforce HTTP callout Flow referring POSMAN collection that my colleague gave me. when I debug it, it gives the following error.

Callout failed for invocable action testexternalservice.testaction. Expected declared response media type application/json, but got application/atom+xml; charset=utf-8; type=feed for operation testaction and service testexternalservice

I understand it as that the response should be in JSON and not in XML. Maybe HTTP callout by default gives a response in the XML. so, get the response in JSON I try to add Accept:application/json in the request header but not finding any option to add it. How can I do that?

1
  • Can you provide more details? what is your code? and what is the test API url for us to debug if it is for public?
    – Wayne Ni
    Mar 30 at 12:22

2 Answers 2

0

you need to create the external credentials related to the named credential that you are going to use in your http callout in the flow

under External credential that you have created you can add custom http request headers

-1

The default in Salesforce Rest API is already appplication/json so you do not even need to precise it unless different, wich mean the problem is on your side then.

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_resources.htm

I guess you wanna set up headers in Postman on the collection level You can set i up in the Headers tab like mentionned in the documentation here: https://learning.postman.com/docs/sending-requests/create-requests/headers/

2
  • I am not directly importing the POSTMAN collection. I am referring to it and trying to make HTTP request in the salesforce FLOW where I am not finding any option to set headers and when I run it without setting Accept:application/json, It gives above error. Mar 26 at 11:19
  • help.salesforce.com/s/… ?
    – gdurelle
    Mar 26 at 19:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .