02-06-2014 09:20 AM
I am trying to invoke a remote REST API that returns a JSON Object.
From Browser the API Call looks like this
http://ipam-dev/phpipam/api/?app_id=api&controller=sections&action=read&id=6
Returns
{"success":true,"data":{"id":"6","name":"Telford Subnets","description":"","masterSection":"0","permissions":"{\"4\":\"1\"}","strictMode":"1","subnetOrdering":null,"order":null,"editDate":null,"showVLAN":"0","showVRF":"0"}}
When I try it to use the CPO activity Web HTTP Request it fails with the following error
Cannot send a content-body with this verb-type.
I think the issue here is the content type. The default value is application/xml; charset=utf-8 in the activity, I tried changing it to text, html and json but still did not work. I cannot leave the content type emty either in the activity.
Does anyone has any suggestion how to make a REST call from CPO using the activity Web HTTP Request
Solved! Go to Solution.
02-06-2014 09:38 AM
Try changing GET to POST (in the CPO_REST-CALL-RQ.png screen). Sending body content usually requires a POST not a GET.
02-06-2014 09:38 AM
Try changing GET to POST (in the CPO_REST-CALL-RQ.png screen). Sending body content usually requires a POST not a GET.
02-06-2014 10:02 AM
Yes, POST did work...Thanks
02-06-2014 09:59 AM
Check out my blog series @
https://supportforums.cisco.com/community/netpro/data-center/intelligent_automation?view=blog
I write a ton on custom content development and have written on all kinds of web calls including JSON.
It looks like you just want to call that URL
http://ipam-dev/phpipam/api/?app_id=api&controller=sections&action=read&id=6
If that is the case, that should be your relative URL.
Your type should be a GET since you are using Query String methods in the URL call and then your content type can be application/json or application/text should be ok.
Your message you are sending should be blank as using a query string setup does not POST anything back to the webserver. Based on your URL, the web server pulls it's variables out of the query string.
If you were POSTING something it would be more of the vain of ....
as the relative URL
and then the message could be anything from XML to Query String to JSON.
Feel free to email me if you need more info.
--shaun
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide