Dynamic value of API connector problem

I have been trying to connect to Clicksend in order to purchase a phone number via API. I’ve been able to setup lots of other API’s to them but having problems with this one.

When initializing the API connector using a static value it will connect, and successfully purchases one of their phone numbers, however I can’t get it to make the purchase when im selecting a number from their list of numbers dynamically.

Any idea what i’m doing wrong or how to correct the mistake? Im getting an error 404 stating endpoint is invalid, data null?

In the API Call "use as select “action” instead of “data”

Please give the value in the empty field “dedicated_number”.

You are using same parameter “dedicated_number” in API post call and in Json body.

Please use any one, I think in header it’s ok. And untick the private tickbox.

Then re-initialize the call.

If it is a success then go to your workflow and insert dynamically from users’ input.

I’ve tried what you said and its giving me error 404

Any ideas on what im still doing wrong? If i put one of their available numbers into the empty field it purchases the number and charges me. But i cant seem to get it to work dynamically, it just gives error 404

I told you to use as “Action” so you can call the API in the workflow later.

And since I saw two same values I was trying to say check if it is a mistake.

Since you are using post request, it usually needs to have values in Json body.

If the API documentatin says to put the same value both in header and in json body then do it. See if it works.

The error message is telling you the number you’ve used is not available for purchase…

Also, what do you mean by you can’t get it to work dynamically?

1 Like

In my application I have a list of numbers that I’m able to purchase, this list of numbers comes from a get api call, this is fine and working as should

When i click buy now on a particular phone number that is the number that needs to be dynamic in the post api, which purchases the phone number.

I can enter one of their available phone numbers into the post (purchase) api, and it will successfully purchase the number. However i don’t want to statically keep purchasing the numbers.

currently i still cant get the post api to connect with dynamic values and what i get is invalid endpoint.

this is what ive tried so far

I can’t see any header for Authorization.

I’m still not sure what you mean?..

Where are you getting the invalid endpoint error…

Also, why do you have the dedicated_number parameter in both the URL AND the body?

I suspect that’s causing a conflict somewhere…

Having just checked the docs, the dedicated_number should just be in the URL path not the JSON body, so get rid of the JSON body in the call.

It is authenticated. I’ve been able to purchase numbers directly through the api, but only static values, not dynamically

I had been using url path, it still didn’t connect. this is why iv tried in the json body too.

then when initializing i get the invalid endpoint error

That’s because you’re not using a valid endpoint… (you haven’t included a value for dedicated_number)

I’ve done that too, when i put a value this is what i get

I think you are doing the authorization wrong way.
I should look like this

Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==

And also please select “Authentication” to “None” then try again to see what happens.

When i set it to authorization none this is what happens. the authorisation is fine. ive setup 5 or 6 other api connections to clicksend and they all work perfect. Just this one is giving me problems.

Yes… so the error message is telling you the number is not available to be bought.

Are you saying you think that’s wrong?

If that’s the case then you’d be better off contacting clicksend to see why it’s not available when you think it should be.

(but I don’t believe they would give you that error if it’s not the case)

You will need both Authentication and Authorization.
You have done the Authentication right, but there is no Authorization.
You will have to add a Header for Authorization. Please check the documentation carefully .

So keep the Authentication same as it was before just add a Authorization header.
Please read the documentation to set the value.

And you don’t need anything in Json body I think because there is no documentation about this in their website.

I can get the API to initialize, the API isnt wrong, nor is clicksends documentation, i don’t dispute that. I have done it a different way to show maybe a better explanation

These numbers are from a GET call to clicksend, the GET call is to show all the numbers available for purchase. This is the list below.

As a test, I have chosen the number circled in red to perform a purchase. I enter that exact phone number as a static value in API POST to purchase phone number

When i initialize that call, it gives response and is a success

and the phone number is actually purchased and now showing in my clicksend dashboard

The problem is how do i make it so in the photo where i have the buy now buttons in my application it will allow me to dynamically purchase any of those numbers, without having to put that number into the API connector??

The problem is how do i make it so in the photo where i have the buy now buttons in my application it will allow me to dynamically purchase any of those numbers, without having to put that number into the API connector??

you just include the number in your workflow.

I have just purchased number with the setup i shown previously, this isnt to do with authorization otherwise i wouldnt be able to purchase as shown. The problem is dynamic values not working. can only make purchase as a static value from their list of available numbers

@dereksparkeswindowcl Please do as it is said here.