Forum Academy Marketplace Showcase Pricing Features

Parsing data from a context.request api call

I’m sure this is simple but I can’t seem to work out how to extract one value from the body response of an API call using a server-side context.request action.

Return setup

Return Code

Body Response

I just want to have the “checkoutUrl” value available once this response is returned. I thought the way I have it set up would work but I continue getting this error. I am actually having the checkout URL being returned in the console but its throwing the error “Cannot evaluate the child checkouturl on type”.

Any thoughts would be really appreciated!!! @Jici @vini_brito


Could you pass back only response.body.url if that’s all you need?

Or create the entire response as a data type via the api connector and pass the whole thing back as an object. That’s what I would do anyway.


Looks like response.body is a string - hard to be sure, I’m not sure what your console.log() looks like…

But if it is, you would need to parse it before accessing any of the keys: JSON.parse(response.body).checkoutUrl


1 Like

It’s probably a client-side error…
Your server-side plugin seems to work fine as you see the result of NFT Checkout call in console, so the problem is in some different place.

Have a look into server-side logs.

1 Like

Thank you all for your suggestions! Turns out I just needed to stringify the returned response :+1:

1 Like