Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I'm trying to use an external API that requires a curl request. Is this possible using the content loader functions?
Hi David,
I think the functions in 05.01.03.03 ContentLoaderFunctions, specifically GetText will be perfect for this (but also check the other functions there).
Available of course in the snippets :)
BR,
Vladimir
can you provide me with an example? I'm trying to use an API that requires the request
curl https://api.domain.com/v2/shipments \
-u {YOUR API KEY}:
I've used GetXML for other APIs but can't see how I would be able to consume this one.
I've tried this:
var url = https://api.domain.com/v2/shipments
var params = {
url: url /* STRING /,<br> username: apiKey / STRING */,
};
var result = Resources["ContentLoaderFunctions"].PostText(params);
but get "unauthorized 401" as a response.
are you having trouble with the spaces and the slash? Did you try using things like %20 or escape characters?
Pai - I don't see what you mean. there are no spaces in the url. I opened a ticket with support and they said that the code below worked, but I still receive an unauthenticated error
result = Resources["ContentLoaderFunctions"].PostJSON({
url: "https://api.easypost.com/v2/shipments",
password: "",
username: "d7WlVQmMEFlzQ5a9GvbfXA",
timeout: 30
});
David,