Service Virtualization

 View Only
  • 1.  REST Invoke API not working with linux cURL command

    Posted May 11, 2016 04:50 PM

    Hi All,

     

    I am trying to access DevTest REST Invoke API using curl command with default "admin" devtest user but always getting empty reply from server. Same thing is working with Postman REST client.

     

    Command : curl -H "Set-Cookie: locale=en; userName={\"state\":{\"USER_NAME\":\"s:admin\"}}" -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/vnd.ca.lisaInvoke.virtualService+xml" -X GET http://localhost:1505/api/Dcm/VSEs/VSE

     

    Please suggest. Thanks.



  • 2.  Re: REST Invoke API not working with cURL command

    Broadcom Employee
    Posted May 11, 2016 05:09 PM

    What operation are you trying to invoke using the REST API? Are you trying to get information on a particular running VSE? If so this is what should get you the result -

     

    curl -u admin:admin http://<host>:1505/api/Dcm/VSEs/Dev_VSE_1

     

    Let me know.



  • 3.  Re: REST Invoke API not working with linux cURL command

    Posted May 11, 2016 05:43 PM

    Thanks Koustubh. I was trying to get information on a particular running VSE. I did what you said but still getting empty reply from server message.



  • 4.  Re: REST Invoke API not working with linux cURL command

    Broadcom Employee
    Posted May 11, 2016 05:47 PM

    what exactly is your command output? Can you paste it here?

    The only time I get a blank command line output is when my username and/or password are wrong. Else you will get at least something from the server giving you the error details or the success message.



  • 5.  Re: REST Invoke API not working with linux cURL command

    Posted May 11, 2016 05:56 PM

    Here is the curl command output -

    Same url is working from POSTMAN REST Client -



  • 6.  Re: REST Invoke API not working with linux cURL command

    Broadcom Employee
    Posted May 11, 2016 06:09 PM

    Sorry this has to be specific to curl as the REST call is working fine on your machine.



  • 7.  Re: REST Invoke API not working with linux cURL command

    Broadcom Employee
    Posted May 11, 2016 06:23 PM


  • 8.  Re: REST Invoke API not working with linux cURL command

    Posted May 12, 2016 03:14 PM

    Hi Koustubh, Thanks for sharing a link. I am still facing issue with curl and wget utilities (Linux). Everything works fine with postman restclient tool (Windows). I am not sure whether its any header constraints at DevTest server.



  • 9.  Re: REST Invoke API not working with linux cURL command

    Posted May 13, 2016 04:20 PM

    see my little scripts for deploymar (start/stop/remove) using curl..(on linux)... I never supply the authorization header myself.. I let curl do that.

    search here on deploymar



  • 10.  Re: REST Invoke API not working with linux cURL command

    Posted May 16, 2016 04:27 PM

    Hi AVSDevTest,

     

    Have you been able to find a resolution for this question? If sure, please be sure to post what worked back here so other users can benefit!

     

    Thanks,

    Melanie