Zone

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
m (1 revision: Release 86)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This operation will return all zones per account
+
= GET /accounts/''{accountId}''/flexcloud/zone =
 +
Returns all available zones for the specified account.
 +
__TOC__
 +
== Request ==
 +
<code>GET /accounts/''{accountId}''/flexcloud/zone</code>
  
'''GET''' /zones
+
==== Request Parameters ====
 +
; accountId - ''string''
 +
: The selected account Id.
  
== Result ==
+
== Response ==
=== JSON ===
+
 
 +
=== Status Code ===
 +
; 200 OK
 +
: Success
 +
 
 +
; 401 Unauthorized
 +
: Failure - This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
 +
 
 +
; 403 Forbidden
 +
: Failure - The resource is forbidden for this user
 +
 
 +
; 404 itemNotFound
 +
: Failure - When trying to get the zones with invalid account number
 +
 
 +
=== Response Body ===
 
  <nowiki>
 
  <nowiki>
 
{
 
{
  "account_number":[
+
  "account_number":[
      {
+
    {
          "zone": "zone_textkey",
+
      "zone": "zone_id",
          "location": "location_zone"
+
      "location": "zone_location"
      },
+
    },
      {
+
    {
          "zone": "zone_textkey2",
+
      "zone": "zone_id",
          "location": "location_zone2"
+
      "location": "zone_location"
      }
+
    }
  ]
+
  ]
}
+
}</nowiki>
</nowiki>
+
 
 +
==== Parameters ====
 
; account_number - ''string''
 
; account_number - ''string''
: Account number for which are the zones. There can be several accounts per user.
+
: Account for which the zones are available. There can be several accounts per response.
  
 
; zone - ''string''
 
; zone - ''string''
: Zone textkey
+
: Zone Id.
  
 
; location - ''string''
 
; location - ''string''
: Location of the zone
+
: Location of the zone.
  
== Response Codes ==
+
== Examples ==
; Success:
+
:''HTTP/1.1 200 OK''
+
  
; Failure:
+
=== Successfully get the zones ===
:''HTTP/1.1 401 Unauthorized'' - This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
+
'''Request'''
:''HTTP/1.1 403 Forbidden'' - The resource is forbidden for this user
+
  <nowiki>
 +
GET /accounts/smith1234/flexcloud/zone
 +
Authorization: Basic {Base64-encoded username:password string}</nowiki>
  
== Examples ==
+
'''Response'''
'''Successfully get the zones'''
+
<nowiki>
:'''GET''' <nowiki>http://{api_server}/zones</nowiki>
+
200 OK
  
''Request Headers:''
+
{
     Content-Type:application/json
+
  "smith1234":[
     Charset=UTF-8
+
     {
    Authorization:Base64-encoded username & password string
+
      "zone": "USOTE-2012-TAMPA",
 +
      "location": "ote.2012.tampa"
 +
     }
 +
  ]
 +
}</nowiki>
  
''Response Code:''
+
=== Failure while trying to make an unauthorized request ===
<pre>HTTP/1.1 200 OK</pre>
+
'''Request'''
 +
<nowiki>
 +
GET /accounts/smith1234/flexcloud/zone
 +
Authorization: Basic {invalid authorization}</nowiki>
  
''Response Body:''
+
'''Response'''
 
  <nowiki>
 
  <nowiki>
{
+
401 Unauthorized</nowiki>
  "smith1234":[
+
      {
+
          "zone": "USOTE-2012-TAMPA",
+
          "location": "ote.2012.tampa"
+
      }
+
  ]
+
}
+
</nowiki>
+
  
'''Failure while trying to make an unauthorized request'''
+
=== Permission denied failure ===
:'''GET''' <nowiki>http://{api_server}/zones</nowiki>
+
'''Request'''
 +
<nowiki>
 +
GET /accounts/smith1234/flexcloud/zone
 +
Authorization: Basic {Base64-encoded username:password string}</nowiki>
  
''Request Headers:''
+
'''Response'''
    Content-Type:application/json
+
<nowiki>
    Charset=UTF-8
+
403 Forbidden
    Authorization:Base64-encoded <span style="color:red">fake_authentication_string</span>
+
  
''Response Code:''
+
{
<pre>HTTP/1.1 401 Unauthorized</pre>
+
  "forbidden": {
 +
    "message": "forbidden",
 +
    "code": 403,
 +
    "details": "",
 +
    "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
 +
  }
 +
}</nowiki>
  
''Response Body:''
+
=== Account Number not found ===
    401 Unauthorized
+
'''Request'''
    This server could not verify that you are authorized to
+
<nowiki>
    access the document you requested. Either you supplied the
+
GET /accounts/fake/flexcloud/zone
    wrong credentials (e.g., bad password), or your browser
+
Authorization: Basic {Base64-encoded username:password string}</nowiki>
    does not understand how to supply the credentials required.
+
 
 +
'''Response'''
 +
  <nowiki>
 +
{
 +
    "itemNotFound": {
 +
        "guid": "23684df5-0532-4794-802d-fdc82e4e7e7c",
 +
        "message": "Resource not found",
 +
        "code": 404,
 +
        "details": ""
 +
    }
 +
}</nowiki>
  
'''Permission denied failure'''
 
:'''GET''' http(s)://{api_server}/zones
 
  
''Request Headers:''
+
== Alternative URI /zones ==
    Content-Type:application/json
+
An alternative way to execute this call is to omit the ''accountId'' portion of the URI. In this case the system assumes the request is executed for the account identified in the [[Authentication|authorization header]].
    Charset=UTF-8
+
    Authorization:Base64-encoded username & password string
+
  
''Response Code:''
+
<code>GET /zones</code>
<pre>HTTP/1.1 403 Forbidden</pre>
+
  
''Response Body:''
+
== See also ==
{
+
* [[FlexCloud Server|FlexCloud Server API]]
    "forbidden":
+
* [[Common Features]]
      {
+
          "message": "forbidden",
+
          "code": 403,
+
          "details": "",
+
          "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
+
      }
+
}
+
  
 +
{{disqus}}
 
[[Category:Hostway API]]
 
[[Category:Hostway API]]
 
[[Category:FlexCloud Server API]]
 
[[Category:FlexCloud Server API]]

Latest revision as of 12:00, 11 October 2013

GET /accounts/{accountId}/flexcloud/zone

Returns all available zones for the specified account.

Contents

Request

GET /accounts/{accountId}/flexcloud/zone

Request Parameters

accountId - string
The selected account Id.

Response

Status Code

200 OK
Success
401 Unauthorized
Failure - This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
403 Forbidden
Failure - The resource is forbidden for this user
404 itemNotFound
Failure - When trying to get the zones with invalid account number

Response Body

{
  "account_number":[
    {
      "zone": "zone_id",
      "location": "zone_location"
    },
    {
      "zone": "zone_id",
      "location": "zone_location"
    }
  ]
}

Parameters

account_number - string
Account for which the zones are available. There can be several accounts per response.
zone - string
Zone Id.
location - string
Location of the zone.

Examples

Successfully get the zones

Request

GET /accounts/smith1234/flexcloud/zone
Authorization: Basic {Base64-encoded username:password string}

Response

200 OK

{
  "smith1234":[
    {
      "zone": "USOTE-2012-TAMPA",
      "location": "ote.2012.tampa"
    }
  ]
}

Failure while trying to make an unauthorized request

Request

GET /accounts/smith1234/flexcloud/zone
Authorization: Basic {invalid authorization}

Response

401 Unauthorized

Permission denied failure

Request

GET /accounts/smith1234/flexcloud/zone
Authorization: Basic {Base64-encoded username:password string}

Response

403 Forbidden

{
  "forbidden": {
    "message": "forbidden", 
    "code": 403, 
    "details": "",
    "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
  }
}

Account Number not found

Request

GET /accounts/fake/flexcloud/zone
Authorization: Basic {Base64-encoded username:password string}

Response

{
    "itemNotFound": {
        "guid": "23684df5-0532-4794-802d-fdc82e4e7e7c",
        "message": "Resource not found",
        "code": 404,
        "details": ""
    }
}


Alternative URI /zones

An alternative way to execute this call is to omit the accountId portion of the URI. In this case the system assumes the request is executed for the account identified in the authorization header.

GET /zones

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox