Leiste mit Community-Erfolgen erweitern.

Submissions are now open for the 2026 Adobe Experience Maker Awards

Mark Solution

Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.

GELÖST

API Call from javascript node in workflow

Avatar

Level 4

Hi guys, 

 

i am trying to call an API from javascript node in a workflow llike below : 

 

var http = new HttpClientRequest("https://xxxxx/accesstoken")

var buffer = new MemoryBuffer()
buffer.fromString("abc" + ':' + "efg", "iso-8859-1")
http.header["Content-Type"] = "application/x-www-form-urlencoded"
http.header["Authorization"] = "Basic " + buffer.toBase64()
http.body = "grant_type=password&username=conny.roscher@dynata.com&password=PaneL321!@"
http.method = "GET"

http.execute()

var result = http.response.body.toString();
logInfo("Results = " + result)

 

i am getting the below error : 

 

JST-310026 The URL 'https://api.trustpilot.com/v1/oauth/oauth-business-users-for-applications/accesstoken' that the script is trying to access is not part of the authorized addresses in urlPermission (serverconf.xml)

 

i saw in other posts that we need to whitelist so i went to control panel and added this url under instances>URL permissions but still the same error.

 

i saw in one other post to add in destination url : 

https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-standard/how-to-perform-an-api-rest-...

but this is not clear. where should i add my url inorder to overcome this error. can you please eloborate

1 Akzeptierte Lösung

Avatar

Korrekte Antwort von
Community Advisor

Hi,

 

Please try to add this in control Panel. https://api.trustpilot.com

If it's still not working then contact support.

Thanks,

David



David Kangni

Lösung in ursprünglichem Beitrag anzeigen

4 Antworten

Avatar

Korrekte Antwort von
Community Advisor

Hi,

 

Please try to add this in control Panel. https://api.trustpilot.com

If it's still not working then contact support.

Thanks,

David



David Kangni

Avatar

Level 4

Thanks @david, it worked but after this when i run the script i am getting the below error :

 

Results = {"reason":"Unknown grant_type"}

HTTP header 'WWW-Authenticate' used for proxy authentication not found.

 

script : 

 

var http = new HttpClientRequest("https://api.trustpilot.com/v1/oauth/oauth-business-users-for-applications/accesstoken")

var buffer = new MemoryBuffer()
buffer.fromString("hrIrJQO0rKQdWSf" + ':' + "AK4ceo", "iso-8859-1");
http.header["Content-Type"] = "application/x-www-form-urlencoded";
http.header["Authorization"] = "Basic " + buffer.toBase64();
http.header["grant_type"] = "password";
http.header["username"] = "abc.com;
http.header["password"] = "PaneL321!@";
http.body = "grant_type=password&username=abc.com&password=PanesddL321!@";
http.method = "GET"

http.execute()

var result = http.response.body.toString();
logInfo("Results = " + result)

Avatar

Community Advisor

you may need to review the api documentation of TrustPilot. the error stands that grant_type (password here) is unknown

It looks like to obtain a token you need your API Key, API Secret, Trustpilot username and password.

Thanks,

David



David Kangni

Avatar

Level 4
thanks @david. it worked now