Howdy all, I am extremely new to json / api calls....
# cfml-general
t
Howdy all, I am extremely new to json / api calls. I am trying to utilize the slack webhook to post information to our local slack group based on DB information. Would someone who has done something as simple as a test message mind sharing the code so I can understand what it is I'm shooting for? I'm not looking for anything complex, I need those baby steps so I can learn to walk. Here is my code and it absolutely is getting me nowhere:
Copy code
<cfhttp url="<https://hooks.slack.com/services/BLAH/BLAH/BLAHHHHHHHH>" method="POST" result="test">
    <cfhttpparam type="header" name="Content-Type" value="application/json">
    <cfhttpparam type="body" value="data { display_information: {name: {Bot}} {text: {Test}}}">
	</cfhttp>
b
t
Thank you 🙂
Using your code as an example I have this:
Copy code
<cfscript>
	var_message = serializeJSON({text="testing"});
	</cfscript>

<cfhttp url="#Slack_URL#" method="POST" result="objGet">
    <cfhttpparam type="header" name="Content-Type" value="application/json">
    <cfhttpparam type="body" value="#var_message#">
    </cfhttp>

<cfoutput><cfdump var="#objGet#"></cfoutput>
Which returns:
Copy code
struct
Charset  [empty string]
ErrorDetail I/O Exception: peer not authenticated
Filecontent Connection Failure
Header [empty string]
MimetypeUnable to determine MIME type of file.
Responseheader struct [empty]
Statuscode Connection Failure. Status code unavailable.
Text YES
Have a feeling this has to do with a ssl error even though i've keytool into the cacerts file the slack ssl cert. Isn't the first time I've had trouble with it on this old box. Do appreciate the code example
b
Is this Lucee or Adobe?
t
Adobe CF9
b
The keystore should be coming from your JRE then
t
Yeah
I've had issues with it not reading the imports prior, I think I'll just wait until I can get the box upgraded
thank you seriously, for the help!
b
Not entirely about that error message,. peer not authenticated is sort of vague, but the lack of a status code seems to imply the connection was never established
note, importing to the keystore usually requires a server reboot to pick up
t
ok cool, I'll give that a try and see if it makes any progress 😄