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 Server web services.

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

To learn more about the latest API version for each release of the Delphix Engine, including schema changes and links to the relevant version of the schema, refer to the API version information page.

Note: Please replace the version number in the code snippet below with the latest API version before running this API call.

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.