API is confusing

Hello everyone,

I am trying to use this API using custom action in a button. It should create a wizard when activated.
I tried every possible solution to receive a successful test result but I keep getting an error 401.

This is the API I should add:

This is how I am adding the API in custom action:


This is the result when running the test:

What I am doing wrong? Can anyone help, please?

Thanks!

One thing is the Content-Type header is missing from your custom action.

2 Likes

The email address part should be your email address plus your API key. email address + api key, not the word ‘email-address’. I think it also needs to be a header, rather than a query parameter.

I haven’t really played with this API but try setting up a Header like this

Header Name:
Authorization

Header Value:
youremailaddress@example.com:YOURAPIKEY

2 Likes

Hi @theadaloguy thank you very much for your reply.

I have tried your suggestion and it is still not working. I think I am missing something, so I contacted the company for help. I will post my reply when it is solved. :+1:

1 Like

OK let us know what the solution was when they get back. I think it’s to do with that authorization field but not sure on the format.

1 Like

I’m not sure if I did it correctly. But test was successful.

In the Docs my eyes went here and

Note that the rest of the documentation and guides will simply includeemail-address and api-keyfor the examples. You must include your authentication header for all requests.

here.

Most clients will implement basic authentication for you, however if you need to implement it yourself, you need to base64 encode your email address and password or API key seperated by a colon. For example, if your email address is keanu.reeves@test.escrow.com and your API key is myhorseisamazing, then you would base64 encode keanu.reeves@test.escrow.com:myhorseisamazing, which would result in a2VhbnUucmVldmVzQGVzY3Jvdy5jb206bXlob3JzZWlzYW1hemluZw==. Using this value, you would then pass the Authorizationheader with the value: Basic a2VhbnUucmVldmVzQGVzY3Jvdy5jb206bXlob3JzZWlzYW1hemluZw==

And under the docs the 401 error code :

image

Then I searched about that in the forum and I found this post that Colin posted.

And I clicked that link and then I gave the email and the password there that I gave on Escrow and it gave me Authorization: Basic and a ID. Then I copied the Basic with the ID and I created a Header first and added Authorization and added the Basic and ID to the value. Then I added a query and I put -u for name and to the value I entered the email address that gave to escrow and entered the API key that created in escrow and added a space between com and API key starting word/number .

Then I created the 2nd query and added Content-Type as name and application/json as the value. Then I pasted the JSON in the Body section and created the inputs and renamed the JSON body with that inputs. And finally I got Test Successful.

I’m not so much good at working with API’s. Have a little a knowledge about it. Not sure if I did it correctly :slightly_smiling_face:

Thank you

2 Likes

Thank you so much for the help @dilon_perera

I have followed all the instructions you mentioned precisely, but I am still getting an error 401

Below is what I inserted so far


I used my sandbox email, and API Key created inside that account. I am not sure what I am doing different from you for the authentication. Any suggestions would be really appreciated, thanks again!

Your Welcome!

You have got the value for the header from here right?

And you have put your escrow email and password right? Because when I tested with a fake one it didn’t worked and received the 401 error. I think you have to put the email and password that you used for login to escrow. And If I’m correct you need to use this value as for your every escrow API integration.

1 Like

Hi @dilon_perera

I just refreshed the page and repeated the same process you did. I used the same link for basic authentication, added my email and password, and everything similar to the images I attached previously.

Could it be something related to the body? I basically added an input for everything between {"…"} and example values are similar to the API documentation in JSON.

But you get the same error? ( 401 )

You entered your correct email and password on creating the header right? The email and password that you gave on escrow to signup.

If you get the same error ( 401 ) I think it may not related to your JSON Body.

1 Like

yes, I entered the correct email and password for the sandbox. I keep getting the same error (401).

I am still waiting for a reply from escrow.com their support is slow. I’ll keep you updated on a solution they will propose by next week.

After discussing this matter privately with @dilon_perera he proposed that I use this URL instead because I was using a sandbox account.

https://api.escrow-sandbox.com/integration/pay/2018-03-31

It finally worked thanks to him. I am so thankful for your help! So much appreciated! :slight_smile:

2 Likes

Yeah the problem is he is using a Sandbox email. So the Base URL has to be changed like this ( Image added :point_down: )

For me the test was successful first because I didn’t use a sandbox email. And after I tried with a sandbox email I got the same error ( 401 ) and after reading the Docs it says if you are using a sandbox email the Base URL has to be like this. ( Image added :point_down:). And tried changing the Base URL and the test was successful!

2 Likes

Great and Your Welcome!

1 Like