How to write RESTful web services client based on curl

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
I need to write a RESTful web service client for Delphix.I am new to delphix and RESTful webservices.How can I write a client based on the below curl.

 Create Delphix API Session

$ curl -s -X POST -k --data @- http://delphix-server/resources/json/delphix/session \&nbsp;&nbsp;&nbsp;&nbsp;-c ~/cookies.txt -H "Content-Type: application/json" <<EOF<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;"type": "APISession",<br>&nbsp;&nbsp;&nbsp;&nbsp;&quot;version&quot;: {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"type": "APIVersion",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"major": 1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"minor": 4,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"micro": 3<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br>EOF
Delphix Login

$ curl -s -X POST -k --data @- http://delphix-server/resources/json/delphix/login \&nbsp;&nbsp;&nbsp;&nbsp;-b ~/cookies.txt -H "Content-Type: application/json" <<EOF
&nbsp;&nbsp;&nbsp;&nbsp;"type": "LoginRequest",
&nbsp;&nbsp;&nbsp;&nbsp;"username": "delphix_username",
&nbsp;&nbsp;&nbsp;&nbsp;"password": "delphix_password"

Photo of Gundamaiah A

Gundamaiah A

  • 122 Points 100 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Mouhssine SAIDI

Mouhssine SAIDI

  • 4,732 Points 4k badge 2x thumb

Simple example with no control points



export user=delphix_admin
export pass=delphix
export DE=

get_session {
curl -s -X POST -k --data @- http://${DE}/resources/json/delphix/s... \
-c ~/cookies.txt -H "Content-Type: application/json" <<
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,420 Points 10k badge 2x thumb
Hey Gundamaiaih, I am not quite sure what you mean by "need to write a restful web services client".

If you are on Unix/Linux, you can put those curl calls into a shell script.
If you are on Windows, you can use the curl equivalent and throw that into a powershell script

If you want something that is universal, then I would suggest using the Delphix Python bindings (you can get that through your Delphix Channel Manager or Sales Rep). This is the suggested course of action for enterprise integration, etc.