createHttpEffect - parameter for body

Tommy Jensen
Giga Guru

I want to build a component to retrieve data but the rest api requires some parameters to be passed as json in the request body.

I am looking at the documentation for createHttpEffect and I cannot figure out how to send a json body with the request.

 Does anybody know what parameters this should be passed in?

1 ACCEPTED SOLUTION

Hi Tommy,

I'll do a little digging and see if I can find something outside of the docs on developer. That being said, one of the things we demonstrated on last week's shows was using a Flow Designer action to consume an external API, then calling that action from a scripted rest API, and consuming the SRAPI from our component. That way we can abstract things from the component a bit and do any heavy lifting in the SRAPI. If you are looking to consume an external API from your component, that might be an architecture to look at either way.

View solution in original post

15 REPLIES 15

This is the right answer on how to form the body.  dataParam will contain the request body, and you have to pass it an object that's value is the JSON object body. 

Don't do this, it will not work:

dataParam: {
status: "requested",
user: properties.user.value,
start_date: properties.startDate,
end_date: properties.endDate
}