Help with Glide Call API and Apify (400 error)

I am using this Apify actor.

I can test an api all successfully in postman.
I pasted the endpoint and body from Glide into postman.

Desperate to solve :frowning:
Trying to figure out why I get a 400 error from Glide but exact same data works via postman.

Update: If I paste the endpoint and body into the Call API configure action form, then it works! but using the same values from a table column doesn’t work.

Ahhhhh!

I need the body to be dynamic.

My guess would be that your dynamic JSON may not be valid. You can check this by copy/pasting the generated JSON into an online validator such as https://jsonlint.com/

It looks like you are using a Template column to generate the JSON. Best practise is to use the JSON Object and/or JSON Template columns to generate it. This ensures you will always get valid JSON.

wow, amazing, will try now. this is hurting me :upside_down_face:

how do I create this where the url is dynamic using json object?
{ “startUrls”:[{“url”:“https://www.juremont.com.au/”}], “maxCrawlingDepth”:5 }

or do I need a template?

looks like I need a template, however I can’t get the substitute values working now. Help?

Bare strings should be quoted when using as replacements. eg. "https://example.com"
But should you be using a column value there?

I tried both.

So what do change?
“$link”

won’t that turn into “whatever link I enter or a column value that is also a link”?

Oh! I removed the “” in my value and it worked so “url”: $link.
Amazing!!!

and it still fails with a 400 error. sigh

For context, this works:

This fails (using this column value as the json)

this is the output I see in Glide (assuming this is exactly what is substituted into the call using a column value:

However, copying from the data editor and pasting into the jsonlint tool gives me:
Screenshot 2024-12-13 at 14.38.09

Where are the “” coming from?? Is Glide adding “” for no reason when coming from a column value and this is the problem?

That sometimes happens when you copy/paste. I think it’s a Glide bug. Try it 2 or 3 times until the extra quotes disappear. Note that it won’t impact what is actually generated.

Could it be the trailing forward slash on the URL that is causing the problem?

1 Like

k sounds like no big deal then, phew.

It doesn’t work with or without it, oh man.

Wait no! I removed it and it worked. Oh my goodness, thanks so much @Darren_Murphy I have tried so many permutations that I hadn’t tried everything else plus no trailing /.

Legend

1 Like

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