Skip to main content
Skip table of contents

API cookbook: authentication

This API cookbook recipe describes how to create an authenticated session for using the Delphix Sever web services.

Before you can use any Delphix Web Service API’s you need to create a session, and then authenticate the session by providing valid Delphix account credentials.

Create Delphix API Session

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

Response
{
   "status":"OK",
   "result": {
       "type":"APISession",
       "version": {
           "type": "APIVersion",
           "major": 1,
           "minor": 4,
           "micro": 3
       },
       "locale": "en_US",
       "client": null
   },
   "job": null
}
EOF

Once the session has been established, the next step is to authenticate to the server by executing the LoginRequest API. Unauthenticated sessions are prohibited from making any API calls other than this login request. The username can be either a system user or domain user, and the backend will authenticate using the appropriate method. This example illustrates logging in via curl using cookies created when the session was established:

CODE
$ curl -s -X POST -k --data @- http://delphix-server/resources/json/delphix/login \
-b cookies.txt -c cookies2.txt -H "Content-Type: application/json" <<EOF
{
"type": "LoginRequest",
"username": "delphix_user",
"password": "delphix_pass",
"target": "DOMAIN"
}
EOF

The new cookie (cookie2.txt) will need to be used in subsequent API requests. The login API currently only supports authentication by a password. There is no way to authenticate using any shared key or alternate authentication strategy.

It is generally recommended to set the API session version to the highest level supported by your Delphix Engine.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.