Connecting to an External API

Hey everyone,

I have an API key for an external API. If I use the API through my browser, the information is demonstrated as it should. However, when I tried to set this up as a REST API in ReTool as a resource using the relevant method and keys it gave me an error.

Am I doing something wrong? My API URL is something like:

https://api.externalwebsite.com/api?module=tx&action=getreceipt&hash=987345789435785352&apikey=7845387945387543

And here is the response I received, when I tried to call it via a REST API:

"response": {
    "data": {
      "message": "An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine."

Solved by self.

In the end, I just used a JS Query instead and used the following code:

let url = 'https://www.myurl.com';

fetch(url)
.then(res => res.json())
.then(out =>
  console.log('Checkout this JSON! ', out))
.catch(console.log('We have a problem, Houston.'));

Obviously, you will want to return the JSON instead. Not do funny messages :wink:

1 Like