SAM4H Rest-API Documentation

This is the documentation of the SAM4H API.

Authorization

Get authorization token by sending username and password

Endpoint

POST /api/auth/login

Parameters

Name Description
login required The login of the user
password required Password

Request

Route

POST /api/auth/login

Headers

Content-Type: application/x-www-form-urlencoded

Body

login=user13&password=Password123

cURL

curl "http://sam4h_host:3003/api/auth/login" -d 'login=user13&password=Password123' -X POST \
	-H "Content-Type: application/x-www-form-urlencoded"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"9f105d43a87e9014d5afe9909ce9ce0b"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: request_method=POST; path=/
_session_id=81acbf4b349028fedd9bac764372ad8c; path=/; HttpOnly
X-Request-Id: c67095dd-2e79-4cd2-85a1-6a92c564e67d
X-Runtime: 0.012100
Content-Length: 141

Body

{
  "status": "success",
  "auth_token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjR9.AfqKIHLPl7iMcXfqetzMisuESxj_Ls132uFkv5-iCs0"
}

When sending wrong credentials

Endpoint

POST /api/auth/login

Parameters

Name Description
login required The login of the user
password required Password

Request

Route

POST /api/auth/login

Headers

Content-Type: application/x-www-form-urlencoded

Body

login=arianna&password=Ad9eZrUpHu

cURL

curl "http://sam4h_host:3003/api/auth/login" -d 'login=arianna&password=Ad9eZrUpHu' -X POST \
	-H "Content-Type: application/x-www-form-urlencoded"

Response

Simulated Response

Status

401

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
Cache-Control: no-cache
Set-Cookie: request_method=POST; path=/
_session_id=a27e6a05f6e321aa0d20bfd4e6483da2; path=/; HttpOnly
X-Request-Id: d88c7648-fe45-4796-a168-d892d22c2eb8
X-Runtime: 0.012602
Content-Length: 57

Body

{
  "status": "unauthorized",
  "message": "Invalid credentials"
}

Clusters

Get Details of a Cluster

This method get all details for a specific Cluster, identified by its ID.

Endpoint

GET /api/clusters/:id

Parameters

Name Description
id required ID of the Cluster

Request

Route

GET /api/clusters/1

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjJ9.F1cLbSVEM3ZWXCNkasZ5DEYz4RY22kcqU_fT12UWoS0

cURL

curl -g "http://sam4h_host:3003/api/clusters/1" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjJ9.F1cLbSVEM3ZWXCNkasZ5DEYz4RY22kcqU_fT12UWoS0"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"5d3c8bf2ea0858ee97ec3789a5590a4d"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=db3e1566de650290701d16c5190657b2; path=/; HttpOnly
X-Request-Id: 683b552a-023b-47b1-941d-c6bcbf6796a2
X-Runtime: 0.018631
Content-Length: 252

Body

{
  "status": "success",
  "message": "Loaded cluster",
  "data": {
    "id": "1",
    "type": "cluster",
    "attributes": {
      "id": 1,
      "name": null,
      "description": null,
      "asset_nr": null,
      "auto_discover": true,
      "created_at": "2019-04-11T15:00:22.546Z",
      "updated_at": "2019-04-11T15:00:22.546Z"
    }
  }
}

Listing Clusters

This method discover all clusters usable for array_mgmt.

Endpoint

GET /api/clusters

Request

Route

GET /api/clusters

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjJ9.F1cLbSVEM3ZWXCNkasZ5DEYz4RY22kcqU_fT12UWoS0

cURL

curl -g "http://sam4h_host:3003/api/clusters" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjJ9.F1cLbSVEM3ZWXCNkasZ5DEYz4RY22kcqU_fT12UWoS0"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"d3fc26674d55e2128a1c05a9b3cce960"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=bb921eb95d25c7ebc63b7ab9b075f83d; path=/; HttpOnly
X-Request-Id: bbc45705-80ce-40bd-b44f-69af528861c1
X-Runtime: 0.015918
Content-Length: 299

Body

{
  "status": "success",
  "data": [
    {
      "id": 1,
      "name": null,
      "created_at": "2019-04-11T15:00:22.796Z",
      "updated_at": "2019-04-11T15:00:22.796Z",
      "cost_center_id": null,
      "auto_discover": true,
      "schedule_snap_resync": false,
      "resync_day": null,
      "description": null,
      "asset_nr": null,
      "group_id": null,
      "read_only": false
    }
  ],
  "count": 1
}

DpvConfigTemplates

DpvConfigTemplates are the definition, how a new volume must be created. It contains definitions like the pools, where the new volume will be created from or how the new volumes must be replicated.

Get Details of a DpvConfigTemplates by API-Key

This method get all details for a specific DpvConfigTemplate, identified by its API-Key.

Endpoint

GET /api/dpv_config_templates/:id

Parameters

Name Description mandatory
id ID or API-Key of the DpvConfigTemplate true

Request

Route

GET /api/dpv_config_templates/my_key

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjN9.-oES1eFluuqnYKD59fxDNG-nwrs5GIOnhIuiuOCHA3Y

cURL

curl -g "http://sam4h_host:3003/api/dpv_config_templates/my_key" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjN9.-oES1eFluuqnYKD59fxDNG-nwrs5GIOnhIuiuOCHA3Y"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"83bb091193454c0ceac8cde3ccb95017"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=1fbd32f78d4655c8161a0d47f943e7f5; path=/; HttpOnly
X-Request-Id: 7eb2de81-5116-4111-a971-6bde26075988
X-Runtime: 0.080157
Content-Length: 799

Body

{
  "status": "success",
  "message": "Loaded dpv_config_template",
  "data": {
    "id": "1",
    "type": "dpv_config_template",
    "attributes": {
      "id": 1,
      "name": null,
      "api_key": "my_key",
      "cu_begin": null,
      "cu_end": null,
      "start_lun_nr": null,
      "size_editable": null,
      "svol_invisible": null,
      "cmd_dev": null,
      "replication": null,
      "snap": null,
      "snap_cu_begin": null,
      "snap_cu_end": null,
      "created_at": "2019-04-11T15:00:23.581Z",
      "updated_at": "2019-04-11T15:00:23.581Z",
      "cmd_dev_security_value": null,
      "quorum": 0,
      "alua_mode": null,
      "svol_cu_offset": 0,
      "relocation_policy": null,
      "capacity_saving": null,
      "ctg": null,
      "custom_lun_label": null,
      "placeholder_size_in_blks": null,
      "placeholder_storage_array_id": null
    },
    "relationships": {
      "groups": {
        "data": []
      },
      "dp_vol_sizes": {
        "data": []
      },
      "pools": {
        "data": []
      },
      "snap_pools": {
        "data": []
      },
      "placeholder_storage_array": {
        "data": null
      }
    }
  }
}

Get Details of a DpvConfigTemplates by ID

This method get all details for a specific DpvConfigTemplate, identified by its ID.

Endpoint

GET /api/dpv_config_templates/:id

Parameters

Name Description mandatory
id ID or API-Key of the DpvConfigTemplate true

Request

Route

GET /api/dpv_config_templates/1

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjN9.-oES1eFluuqnYKD59fxDNG-nwrs5GIOnhIuiuOCHA3Y

cURL

curl -g "http://sam4h_host:3003/api/dpv_config_templates/1" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjN9.-oES1eFluuqnYKD59fxDNG-nwrs5GIOnhIuiuOCHA3Y"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"72f1a57e44a6c8afb7df1b807899835d"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=5a182e1ce143b7940d4397cf72f6ea08; path=/; HttpOnly
X-Request-Id: 228834f1-0614-4c66-a5a8-4b2f48227cf6
X-Runtime: 0.020721
Content-Length: 799

Body

{
  "status": "success",
  "message": "Loaded dpv_config_template",
  "data": {
    "id": "1",
    "type": "dpv_config_template",
    "attributes": {
      "id": 1,
      "name": null,
      "api_key": "my_key",
      "cu_begin": null,
      "cu_end": null,
      "start_lun_nr": null,
      "size_editable": null,
      "svol_invisible": null,
      "cmd_dev": null,
      "replication": null,
      "snap": null,
      "snap_cu_begin": null,
      "snap_cu_end": null,
      "created_at": "2019-04-11T15:00:23.874Z",
      "updated_at": "2019-04-11T15:00:23.874Z",
      "cmd_dev_security_value": null,
      "quorum": 0,
      "alua_mode": null,
      "svol_cu_offset": 0,
      "relocation_policy": null,
      "capacity_saving": null,
      "ctg": null,
      "custom_lun_label": null,
      "placeholder_size_in_blks": null,
      "placeholder_storage_array_id": null
    },
    "relationships": {
      "groups": {
        "data": []
      },
      "dp_vol_sizes": {
        "data": []
      },
      "pools": {
        "data": []
      },
      "snap_pools": {
        "data": []
      },
      "placeholder_storage_array": {
        "data": null
      }
    }
  }
}

Listing DpvConfigTemplates

This method discover all accessible dpv_config_templates.

Endpoint

GET /api/dpv_config_templates

Request

Route

GET /api/dpv_config_templates

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjR9.AfqKIHLPl7iMcXfqetzMisuESxj_Ls132uFkv5-iCs0

cURL

curl -g "http://sam4h_host:3003/api/dpv_config_templates" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjR9.AfqKIHLPl7iMcXfqetzMisuESxj_Ls132uFkv5-iCs0"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"11985739bd293e278c683f4f903f5a63"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=bc241b4213817d885e0b139605002457; path=/; HttpOnly
X-Request-Id: ec607c11-4c78-4930-88b0-7f10953d6400
X-Runtime: 0.014309
Content-Length: 566

Body

{
  "status": "success",
  "data": [
    {
      "id": 1,
      "name": null,
      "cu_begin": null,
      "cu_end": null,
      "start_lun_nr": null,
      "size_editable": null,
      "svol_invisible": null,
      "cmd_dev": null,
      "replication": null,
      "snap": null,
      "snap_cu_begin": null,
      "snap_cu_end": null,
      "created_at": "2019-04-11T15:00:24.075Z",
      "updated_at": "2019-04-11T15:00:24.075Z",
      "cmd_dev_security_value": null,
      "quorum": 0,
      "alua_mode": null,
      "svol_cu_offset": 0,
      "relocation_policy": null,
      "capacity_saving": null,
      "ctg": null,
      "custom_lun_label": null,
      "placeholder_size_in_blks": null,
      "placeholder_storage_array_id": null,
      "api_key": "my_key"
    }
  ],
  "count": 1
}

Luns

Get Details of a Lun

This method get all details for a specific Lun, identified by its ID.

Endpoint

GET /api/luns/:id

Parameters

Name Description
id required ID of the Lun

Request

Route

GET /api/luns/1

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjN9.-oES1eFluuqnYKD59fxDNG-nwrs5GIOnhIuiuOCHA3Y

cURL

curl -g "http://sam4h_host:3003/api/luns/1" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjN9.-oES1eFluuqnYKD59fxDNG-nwrs5GIOnhIuiuOCHA3Y"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"25aca2c229a2a30a9e7db9c3759c8c0f"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=ee7d4f5eb0dea2553e85ec927d1d5afe; path=/; HttpOnly
X-Request-Id: 73cb47b6-965b-420e-bbc1-d42e5255ed84
X-Runtime: 0.040144
Content-Length: 916

Body

{
  "status": "success",
  "message": "Loaded lun",
  "data": {
    "id": "1",
    "type": "lun",
    "attributes": {
      "id": 1,
      "dev_num": 1,
      "nickname": null,
      "command_device": null,
      "cache_lun": null,
      "cvs": null,
      "luse": null,
      "migration_volume": null,
      "external_volume": null,
      "guard_volume": null,
      "vvol": null,
      "horc": null,
      "shadow_image": null,
      "cow": null,
      "jnl": null,
      "hdt": null,
      "hdp": null,
      "pool_volume": null,
      "quorum_disk": null,
      "encrypted": null,
      "system_disk": null,
      "tse": null,
      "slpr": null,
      "clpr": null,
      "vol_type": null,
      "status": null,
      "operation_type": null,
      "operation_rate": null,
      "mp_number": null,
      "ssid": null,
      "size_in_blks": null,
      "virtual": false,
      "gad": null,
      "v_dev_num": null,
      "thin_image": null,
      "alua": null,
      "hnass": null,
      "hnasu": null,
      "mg": null,
      "t10pi": null,
      "dsd": null,
      "created_at": "2019-04-11T15:00:23.073Z",
      "updated_at": "2019-04-11T15:00:23.073Z"
    },
    "relationships": {
      "storage_array": {
        "data": null
      },
      "resource_group": {
        "data": null
      },
      "source": {
        "data": null
      },
      "replications": {
        "data": []
      }
    }
  }
}

Listing Luns

This method discover all accessible luns.

Endpoint

GET /api/luns

Request

Route

GET /api/luns

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjN9.-oES1eFluuqnYKD59fxDNG-nwrs5GIOnhIuiuOCHA3Y

cURL

curl -g "http://sam4h_host:3003/api/luns" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjN9.-oES1eFluuqnYKD59fxDNG-nwrs5GIOnhIuiuOCHA3Y"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"fdb0f4b6b5edfe89262607f91741c0b9"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=bcce76e5e206bc0df0922eddba1461ee; path=/; HttpOnly
X-Request-Id: 3be79aaf-520c-4f7e-8ed3-c84e8923aec5
X-Runtime: 0.014997
Content-Length: 842

Body

{
  "status": "success",
  "data": [
    {
      "id": 1,
      "dev_num": 2,
      "nickname": null,
      "command_device": null,
      "cache_lun": null,
      "cvs": null,
      "luse": null,
      "migration_volume": null,
      "external_volume": null,
      "guard_volume": null,
      "vvol": null,
      "horc": null,
      "shadow_image": null,
      "cow": null,
      "jnl": null,
      "hdt": null,
      "hdp": null,
      "pool_volume": null,
      "quorum_disk": null,
      "encrypted": null,
      "system_disk": null,
      "tse": null,
      "slpr": null,
      "clpr": null,
      "vol_type": null,
      "status": null,
      "operation_type": null,
      "operation_rate": null,
      "mp_number": null,
      "ssid": null,
      "source_type": null,
      "source_id": null,
      "storage_array_id": null,
      "created_at": "2019-04-11T15:00:23.303Z",
      "updated_at": "2019-04-11T15:00:23.303Z",
      "size_in_blks": null,
      "virtual": false,
      "gad": null,
      "v_dev_num": null,
      "resource_group_id": null,
      "thin_image": null,
      "alua": null,
      "hnass": null,
      "hnasu": null,
      "mg": null,
      "t10pi": null,
      "dsd": null,
      "journal_id": null
    }
  ],
  "count": 1
}

Tasks

Get Details of a Task

This method get all details for a specific Task, identified by its ID.

Endpoint

GET /api/tasks/:id

Parameters

Name Description
id required ID of the Task

Request

Route

GET /api/tasks/1

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjJ9.F1cLbSVEM3ZWXCNkasZ5DEYz4RY22kcqU_fT12UWoS0

cURL

curl -g "http://sam4h_host:3003/api/tasks/1" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjJ9.F1cLbSVEM3ZWXCNkasZ5DEYz4RY22kcqU_fT12UWoS0"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"04a1f5e840f33dec82c0661f610d5c81"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=311aa2b1cdbae8bd1e6f5195a996bb89; path=/; HttpOnly
X-Request-Id: 1fcd5cb3-c54e-4e42-9916-b8c6f69d2ec4
X-Runtime: 0.024650
Content-Length: 451

Body

{
  "status": "success",
  "message": "Loaded task",
  "data": {
    "id": "1",
    "type": "task",
    "attributes": {
      "id": 1,
      "target": "anything",
      "method_name": "upcase",
      "state": "new",
      "priority": null,
      "message": null,
      "perc_finished": null,
      "remark": null,
      "output": null,
      "error_msg": null,
      "description": null,
      "result": null,
      "created_at": "2019-04-11T15:00:22.094Z",
      "updated_at": "2019-04-11T15:00:22.094Z"
    },
    "relationships": {
      "task_group": {
        "data": null
      },
      "user": {
        "data": {
          "id": "1",
          "type": "user"
        }
      }
    }
  }
}

Listing Tasks

This method discover all accessible tasks.

Endpoint

GET /api/tasks

Request

Route

GET /api/tasks

Headers

Accept: application/vnd.sam4h.v1+json
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjJ9.F1cLbSVEM3ZWXCNkasZ5DEYz4RY22kcqU_fT12UWoS0

cURL

curl -g "http://sam4h_host:3003/api/tasks" -X GET \
	-H "Accept: application/vnd.sam4h.v1+json" \
	-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTUwODEyMjJ9.F1cLbSVEM3ZWXCNkasZ5DEYz4RY22kcqU_fT12UWoS0"

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"4a1e627484f03ec61af590cac941ecc6"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _session_id=01cd91d81d291d695bcf142ba1af8631; path=/; HttpOnly
X-Request-Id: 46b8ea5d-adbc-4d1e-929a-ed7c27e5080b
X-Runtime: 0.014560
Content-Length: 252

Body

{
  "status": "success",
  "message": "Loaded tasks",
  "data": {
    "data": [
      {
        "id": "1",
        "type": "task",
        "attributes": {
          "id": 1,
          "target": "anything",
          "method_name": "upcase",
          "state": "new",
          "priority": null,
          "message": null,
          "perc_finished": null,
          "remark": null,
          "description": null
        }
      }
    ]
  }
}