Calling RESTful web services from Unix ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Calling RESTful web services from Unix ?
# 1  
Old 09-23-2011
Calling RESTful web services from Unix ?

Hello,

I need to make a function call to a RESTful web service. I tried using curl command but it throws an error 'Mathod not allowed'

curl --request POST <link>

Could someone confirm if Unix can call a RESTful web service and share some examples around the Syntax

Thanks in Advance Smilie !!!

- Amit
# 2  
Old 09-23-2011
Yes. You can use curl to talk to webservices.

You haven't provided much information so what follows is my best guess.

The error message you're seeing is an HTTP 405 response. The particular resource addressed in your URL does not support the POST method. If the server response is HTTP compliant, it should include an "Allow" header enumerating which methods are allowed (GET, PUT, or perhaps some custom methods).

If this guess-analysis is incorrect or you require more detailed help, provide more detailed info. For example, if this is a public url, provide that. Provide your actual curl command in its entirety. Provide the headers sent and received.

Regards,
Alister
# 3  
Old 09-26-2011
Thanks Alister. That was helpful.

I ended up with following command which worked for me:

echo '<parameters><taskName>TestTask</taskName></parameters>' | curl -u usernamSmilieassword -X POST -H 'Content-type: text/xml' -d @- <URL>
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question