Accounts-accountNumber-dedicatedServers-serverId-ipAddresses-ipAddr-monitoring-notificationGroups-groupId-contacts:POST

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
 
m (1 revision)
 

Latest revision as of 13:36, 30 May 2016

POST /accounts/{accountNumber}/dedicatedServers/{serverId}/ipAddresses/{ipAddr}/monitoring/notificationGroups/{groupId}/contacts

This API call is deprecated!

Create a contact

Contents


Request

POST /accounts/{accountNumber}/dedicatedServers/{serverId}/ipAddresses/{ipAddr}/monitoring/notificationGroups/{groupId}/contacts

Request Parameters

accountNumber - string
serverId - string
ipAddr - string
groupId - string
Id of the notification group

URI Parameters

None

Request Headers

Authorization
Specify the Authorization header when requesting details for an order that was already submitted. Follow the instructions for API Authentication.
Content-Type
Required. Set this header to application/json; charset=UTF-8

Request Body

{ 
   "contact": {
      "name": "{contact_name}",
      "type": "{contact_type}", 
      "address": "{contact_address}",
      "onTime": {contact_ontime}, 
      "offTime": {contact_offtime}
   }
}

Parameters

name - string
Descriptive name for this contact.
type - EMAIL/PAGER
address - string
Email or pager number
onTime - int
offTime - int

Response

Status Code

201 Created
Success
400 Bad Request
Invalid user input
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
404 Not Found
The resource requested is not found

Response Body

{
   "contact": {
      "name": "{contact_name}", 
      "onTime": {contact_ontime}, 
      "links": [
         {
            "href": "{{APIBaseURL}}/accounts/{accountNumber}/dedicatedServers/{serverId}/ipAddresses/{ipAddr}/monitoring/notificationGroups/{groupId}/contacts/{contact_id}/",
            "rel": "self"
         }
      ], 
      "address": "{contact_address}", 
      "offTime": {contact_offtime}, 
      "type": "{contact_type}", 
      "id": {contact_id}
   }
}

Parameters

id - string
Unique identifier for this contact.
name - string
Descriptive name for this contact.
type - EMAIL/PAGER
address - string
Email or pager number
onTime - int
offTime - int
links - list
Hypermedia for this resource.

Examples

Successfully create a notification contact

Request

POST https://api.hostway.com/accounts/test-358536378/dedicatedServers/test-358536378-000001338fd091e/ipAddresses/11.22.33.44/monitoring/notificationGroups/186/contacts

{
   "contact": {
      "name": "test_contact", 
      "type": "EMAIL", 
      "address": "abc@abc.com", 
      "onTime": 50400, 
      "offTime": 21600
   }
}

Response

Created (201):
{
   "contact": {
	"onTime": 50400,
	"name": "test_contact",
	"address": "abc@abc.com",
	"offTime": 21600,
	"type": "EMAIL",
	"id": 1556
   },
   "links": [{
	"href": "{{APIBaseURL}}/accounts/test-358536378/dedicatedServers/test-358536378-000001338fd091e/ipAddresses/11.22.33.44/monitoring/notificationGroups/186/contacts/1556",
	"rel": "self"
   }]
}

Failure creating a notification contact with wrong request data

Request

POST https://api.hostway.com/accounts/test-358536378/dedicatedServers/test-358536378-000001338fd091e/ipAddresses/11.22.33.44/monitoring/notificationGroups/186/contacts

{
   "contact": {
      "name": "test_contact", 
      "type": "EMAIL", 
      "address": "abc.com", 
      "onTime": 50400, 
      "offTime": 21600
   }
}

Response

Bad Request (400):
{
   "badRequest": {
      "message": "POST data error", 
      "code": 400, 
      "details": {
         "contact.address": "Invalid email address"
      }
   }
}

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox