Skip to content

REST: Server arrays management

Aleksey Aleev edited this page Aug 3, 2012 · 5 revisions

List all server arrays in project

Path: /rest/projects/(projectId)/server-arrays

Type: GET

Example:

Response:

[ {"id":1,"projectId":1,"name":"WebServers","description":"Servers with running tomcats"} ]

Create server array

Path: /rest/projects/(projectId)/server-arrays

Type: POST

Input data:

{ 
    "name":"WebServers",
    "description":"Servers with running tomcats"
}

Request body consists form a single JSON map contains the following entries:

Entry name Type Mandatory Description
name String Y Name of the server array
description String В Description of the server array

Example results:

Error on creation (common result object):

{
	"isSuccess": false,
	"isNotFound": false,
	"variablesErrors" : {"fieldName": "Error message"},
	"compoundServiceErrors" : ["Error message 1", "Error message 2"]
}

Successful creation:

{
     "result": {
          "id":2,
          "projectId":1,
          "name":"WebServers",
          "description":"Some description"
     },
     "isSuccess":true
}

Update array

Path: /rest/projects/(projectId)/server-arrays/(arrayId)

Type: PUT

Example results:

Error on update: common result object

Successful update:

{
   "result": {
          "id":1,
          "projectId":1,
          "name":"Databse servers",
          "description":"Oracle powered"
   },
   "isSuccess":true
}

Request body: Same as in create

Delete server array

Path: /rest/projects/(projectId)/server-arrays/(arrayId)

Type: DELETE

Example results: See common result object

Get list of servers in a server array

Path: /rest/projects/(projectId)/server-arrays/(arrayId)/servers

Type: GET

Example:

Response:

[
   {"id":9, 
    "arrayId":1, 
    "instanceId":"most powerfull server", 
    "address":"127.0.0.1", 
    "credentialsId": 1
   }
]

Add server to a server array

Path: /rest/projects/(projectId)/server-arrays/(arrayId)/servers

Type: POST

Input data:

{"instanceId":"MyServer","address":"localhost", "credentialsId": 1}

Request body consists form a single JSON map contains the following entries:

Entry name Type Mandatory Description
instanceId String В Unique(per array) server id. Will be generated by genesis if not provided
address String Domain name( should be resolvable via dns used by genesis) or ip address (ip 4 and ip 6 formats supported)
credentialsId Number В  Id of of a credentials record from projects credentials store

Example:

Response:

{
    "result": {
     "id":10,
     "arrayId":1,
     "instanceId":"46e51a09-207f-4e0b-ac62-693dd14f2122",
     "address":"localhost"
    },
    "isSuccess":true
}

Remove server from a server array

Path: /rest/projects/(projectId)/server-arrays/(arrayId)/servers/(serverId)

Type: DELETE

Response: See common result object

Clone this wiki locally