1

I am first time trying out the HTTP callout action inside of the flow. I have added a query string parameter called content and ran the flow using the debug button. I see the expected response but along with that I see an Internal server error message as well. If i call the same api using Postman it get a 200 response. Is there anything I am doing wrong with the setting of the HTTP callout action? Here is the snip -

enter image description here

I am adding here what query string paramter I am sending. enter image description here

And here is what I see on AWS Cloudwatch. I see the response of the content query parameter and why does it say null as in the snip below? enter image description here


EDIT - After sfdcfox answer -

The API that I had called did have some issues which I was able to rectify.

I am still not able to make a successful callout from the flow so far. This is error I am seeing when I run the flow. I do see from the error that it is something wrong that I have done on the mapping. enter image description here

Here is what I see after a successful run of my function in Lambda - enter image description here

This is how I set my Query Parameter keys- enter image description here

And this is how I set my response mapping. Maybe a dumb question. why it is I am getting my response in the body property when I pass in content as my query parameter string or am I missing something here. enter image description here

EDIT - After sfdcfox editted answer -

THanks @sfdcfox for the continued help. The below is what I have for the Query Parameter Keys- enter image description here

And this is what I have as Sample Request - enter image description here

This is the error now and I am not sure where the body2 comes from - enter image description here

3
  • Have you checked the requests in the system that you are calling? Or checked that the request you are sending from Salesforce does actually match what you're sending via Postman? Commented Dec 20, 2023 at 23:46
  • @CallumMacErlich I have added more snips to the original post.
    – sumchans
    Commented Dec 20, 2023 at 23:51
  • 1
    do you have a snippet of a successful request from Postman too? Commented Dec 20, 2023 at 23:59

1 Answer 1

2

Without knowing what API you're calling or anything, I can see your problem fairly immediately. You're setting the query string to endpoint?content=response+from+the+api. However, this endpoint is parsing JSON, presumably from the body. You haven't generated any JSON, so the data is null, and when it tries to read the property of null, you get a null pointer exception. The server language is, of course, a flavor of JavaScript, which is why you're specifically getting Cannot read properties of null (reading 'content'). You need a JSON payload in order to submit the parameters.

See the documentation, specifically:

For POST, PUT, PATCH, and DELETE, provide a sample API request body. Salesforce generates a data structure from the sample request.

  • Click New.
  • Paste a sample JSON request.
  • Click Review and confirm that the Apex data structure is correct.
  • To make changes, edit the text in Sample JSON Request or select data types from the data structure.
  • Click Review.
  • Click Done.

You need to click on the button circled below to open the appropriate dialog:

Button to add a new request body

8
  • I have added more details to my original post after receiving an answer from you. I am unfortunately still stuck.
    – sumchans
    Commented Dec 21, 2023 at 0:54
  • @sumchans You were so close. It needs to be the button above the one you clicked.
    – sfdcfox
    Commented Dec 21, 2023 at 1:05
  • I am so sorry and I totally appreciate the help provided. I have more snips, I am still stuck .
    – sumchans
    Commented Dec 21, 2023 at 1:45
  • @sumchans There should be no query parameters at all. That may be causing the problem.
    – sfdcfox
    Commented Dec 21, 2023 at 2:36
  • 1
    @sumchans Always happy to help!
    – sfdcfox
    Commented Dec 21, 2023 at 16:50

You must log in to answer this question.

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