Curl and CFHTTP/cfhttpparam (resolved)

curl -X POST -d "param1=value1&param2=value2" "https://api-somewebsite.com/v1/"

translated into cfhttp call including authentication token:

	<cfhttp url="https://api-somewebsite.com/v1/" method="post" result="getStuff" timeout="90">
<cfhttpparam type="header" name='authorization' value='Bearer 27jwjewjeis838uwe3743ace3'>
	  <cfhttpparam type="header" name='content-type' value='application/x-www-form-urlencoded'>
	  <cfhttpparam type="body" value='param1=value1&param2=value2'>
	</cfhttp>

result:
“The access token provided does not allow this request to be made”

My suspect is that the token is invalid. What do you think?

looks so, but to check it you’d need to dig into the provided api docs of the service you are accessing. Without that information you can’t say much.

their api doc is extremely poor, same api must use different subdomain based on account type etc. (undocumented), horrible doc designer…

Got it not based on their api doc but sheer something else!

What was it?

2 Likes

Come on, stop wasting people’s time. as you were recent asked nicely, if you post a question and find a solution, take the time to explain the solution.

Tell you what, how about you change you username to your real name?

I guess it would be to embarrassing for you professionally, think about that, next time you post

3 Likes

@justaguy with all due respect, I always like to help others, and mostly it motivates me, because I learn a lot with problems and issues of others. I also give my best to relieve the Lucees Core Dev Team whenever I can, because as a none-active donator this is my payback for this piece of great software I get for FREE.Sincerly, I think they have way more important things to do, than answering questions to which there is plenty of stuff written all over the net. To relieve them, I try to answer forum questions as soon as I can. THAT is my form of donation.

On the other side, I’ve never seen you answering one question of somebody else here. You always placing questions. Instead I’ve seen post of yours, trying to do as little as you can, e.g. short title and a one liner.

Because this is not the first time you don’t want us to know your solution or waste your time in providing one, I won’t tell you also my solution I’d have for your future questions. As soon as you change your mind and start to also contribute to our Lucee CFML community (contributions only by posting questions doesn’t count), I may waste my time to post the solution back to you. Or you get one as soon as you make a donation to the Lucee Project.

Disclaimer: I’m not related in anything to the official Lucee support team. I’m just a cfml dev like you are! I just want to help this software get even better. Hacktoberfesting all the year is what drives me on!

4 Likes

The solution was not exactly technical per se.

That website have multiple API versions and yet their documentation is just for one version.
And then, they have various account types with different permission. Thus, making API calls to their endpoint exceedingly difficult for anyone new to their service.

I performed internet search and then extrapolate and got it working, that’s all.

Suggestion to other developers that may encounter similar problem in the future, try my approach (dig doc first, if it fails go internet search) and see if it would work for you.

A side note:
Regarding complaints about not sharing solution, I usually do but maybe recently I wasn’t attentive to it.

1 Like