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

Nope no help. I have read all that. And the example only use a url with query parameters.

 

I need to send a JSON body with the request.

Tommy Jensen
Giga Guru

@Andrew Barnes - AJB , @Chuck Tomasi , @Brad Tilton : Do any of you have any tips?

I have tried lots of ways to send a body via the dataParams property but cannot figure out the proper way of providing a json body with the http request. I use putsreq.com to catch the sent request.

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.