HTTPget & API REST Strapi

Hi, I’m trying to access information from a local CMS built wih Strapi.
I use GetHTTP and it seems to be responding correctly but I don’t see any informations coming out from Body pin of Split [IO.HTTPResults] node.
On CMS the Collection is not empty, there are a couple of items published and I gave full permission to this Token. Any suggestions ?
Thank you!

Hey,

Kinda hard to help here without having a look at the Strapi instance.

Does it work if you just output the body as a string, without doing the parsing in the ForEach region? Maybe the Parse and XPath nodes throw an exception for whatever reason, which is why you would not see what’s returned by the API ?

Edit : what is that Parse node? Did you try the ParseJSON node?

1 Like

@sebescudie you are right! just output the body I can see the result. stupid of me that I didn’t think of that! :D
The Parse node was just in the GetHttp help patch but I’m not sure ParseJSON works either because the information is in REST format.

From what I understand the Parse node expects an XML input, but Strapi returns JSON, so you might have to use ParseJSON. Note that you’ll have to provide a root element name, otherwise it’ll complain :

image

Also, I would not recommend creating your parser in the ForEach region in the first place : the fact that it only runs when a response arrives will make it super hard to debug. I’d suggest to first output the body as a string from the ForEach region, hold it with HoldLatest and then create your parser. Like that, if something throws an error, you will see it instantly.

Once you’re sure it’s working, you can put it in an operation and re-use it inside the ForEach.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.