I'm playing around the Singly API at the moment, and there are ZERO ColdFusion examples (as far as I can see - and I've gone through a lot of google search results!) So, I'm trying to 'fudge' my way through it.
I've hit a stumbling block with something. I suspect it isn't specific to Singly, but I just can't figure out the syntax. I'm specifically stuck on the authorization. I've gotten as far as doing the second post back, which the docs state:
You will then make a post back to:
https://api.singly.com/oauth/access_tokenWith the following parameters in the body:
client_idYour Singly OAuth 2 client ID
client_secretYour Singly OAuth 2 client secret
codethe code that was passed back in the URL above
Currently, I keep getting an error "no such app" - I suspect this is because I'm not sending the data correctly, because if I manually fire a request (using the same details), it works fine.
The part I'm stuck with is how I go about formatting everything, presumably into a cfhttpparam with a type body. I'm aware I can only use body type once in a cfhttp call. There's no indication that the data needs to be sent as JSON etc
Many Thanks
For the benefit of anyone else searching, Matt Busche suggested sending them as headers. That didn't work, but did point me to try sending them as formFields, which DID work. Here's the working code:
<cfhttp method="POST" url="https://api.singly.com/oauth/access_token">
<cfhttpparam type="formField" name="client_id" value="my_client_id">
<cfhttpparam type="formField" name="client_secret" value="my_client_secret">
<cfhttpparam type="formField" name="code" value="#url.code#">
</cfhttp>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With