REST API Reference Version 5.2.1.0Search

cURL as the REST API Client

Procedure

To test communication to the array using cURL as the Linux-based REST API client:

  1. Use any web browser to export the array CA certificate to the API client machine.
  2. Obtain array API version.

    $ curl -i –cacert ‘<array_cert_filename> -X 'GET' https://10.18.240.146:5392/versions

    Expected output (formatted):

    {
      "data": [
        {
          "name": "v1"
        }
      ]
    }
  3. Authenticate with the array for a session token.

    curl -i --cacert './ca.crt' -X 'POST' -d '{"data":{"password":<my_password>,"username":<my_user>}}' https://<array_name>:5392/<version_number>/tokens

    Expected output (formatted):

    {
      "data": {
        "app_name": "",
        "creation_time": 1430505404,
        "id": "19088d2734f073eee40000000000000000000002bf",
        "last_modified": 1430505404,
        "session_token": "7f39888e5b9ba094f4f3103fb3f923b2",
        "source_ip": "10.12.18.202",
        "username": "admin"
      }
    }
  4. Test the API by using "GET" to retrieve the array name.

    curl -i --cacert './ca.crt' -X 'GET' -H "X-Auth-Token:<token_string>" https://<array_name>:5392/<version_number>/arrays

    Expected output (formatted):

    {
      "data": [
        {
          "id": "09088d2734f073eee4000000000000000000000001",
          "name": "sjc-array355"
        }
      ],
      "endRow": 1,
      "startRow": 0,
      "totalRows": 1
    }