Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Created June 3, 2014 19:32
Show Gist options
  • Save matthewpoer/6f62e25a13b0193786be to your computer and use it in GitHub Desktop.
Save matthewpoer/6f62e25a13b0193786be to your computer and use it in GitHub Desktop.
<cfset data ={
'application' : 'myCFMapp',
'user_auth' : {
'user_name' : 'admin',
'password' : '#hash("admin")#'
},
'name_value_list' :
{
'name' : 'notifyonsave'
}
}
/>
<cfdump var="#SerializeJSON(data)#">
<cfhttp method="post" url="https://localhost/service/v4_1/rest.php">
<cfhttpparam type="formField" name="method" value="login">
<cfhttpparam type="formField" name="input_type" value="JSON">
<cfhttpparam type="formField" name="response_type" value="JSON">
<cfhttpparam type="formField" name="rest_data" value="#SerializeJSON(data)#">
</cfhttp>
<cfset temp = deserializejson(cfhttp.filecontent)>
<cfdump var="#cfhttp#">
<br /><br />
<cfif isDefined("temp.id")>
<cfset data ={
"session":"#temp.id#",
"module_name":"Contacts",
"name_value_list":{
"first_name":"John",
"last_name":"Smith"
}
}
/>
<cfdump var="#SerializeJSON(data)#">
<cfhttp method="post" url="https://localhost/service/v4_1/rest.php">
<cfhttpparam type="formField" name="method" value="set_entry">
<cfhttpparam type="formField" name="input_type" value="JSON">
<cfhttpparam type="formField" name="response_type" value="JSON">
<cfhttpparam type="formField" name="rest_data" value="#SerializeJSON(data)#">
</cfhttp>
<cfdump var="#cfhttp#">
<br /><br />
<cfset data ={
"session":"#temp.id#",
"module_name":"Accounts",
"query":"accounts.deleted=0",
"order_by":"null",
"offset":0,
"select_fields":[
"id",
"name"
],
"link_name_to_fields_array":[
],
"max_results":20,
"deleted":false
}
/>
<cfdump var="#SerializeJSON(data)#">
<cfhttp method="post" url="https://localhost/service/v4_1/rest.php">
<cfhttpparam type="formField" name="method" value="get_entry_list">
<cfhttpparam type="formField" name="input_type" value="JSON">
<cfhttpparam type="formField" name="response_type" value="JSON">
<cfhttpparam type="formField" name="rest_data" value="#SerializeJSON(data)#">
</cfhttp>
<cfdump var="#cfhttp#">
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment