Accounts-accountId-Contacts:GET

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
m (1 revision: Release 99)
 
(7 intermediate revisions by 4 users not shown)
Line 19: Line 19:
  
 
=== Status Code ===
 
=== Status Code ===
;200 OK
+
; 200 OK
 
: Success
 
: Success
  
;404 Not Found
+
; 401 Unauthorized
 +
: The request was sent without an ''Authorization'' header, or the user represented by the value of this header was not properly authenticated.
 +
 
 +
; 403 Forbidden
 +
: The user authenticated for this request is not allowed to access the resource.
 +
 
 +
; 404 Not Found
 
: The specified account Id does not exist or is purged.
 
: The specified account Id does not exist or is purged.
  
Line 28: Line 34:
 
  <nowiki>
 
  <nowiki>
 
{
 
{
   "regular": {
+
   "contactInfo": {
     "city": "Chicago",
+
     "regular": {
    "countryCode": "US",
+
      "name": {
    "email1": "test@test.com",
+
        "salutation": "{salutation}",
    "email2": "",
+
        "firstName": "{firstname}",
    "fax": "",
+
        "middleName": "{middleName}",
    "firstName": "John",
+
        "lastName": "{lastName}",
    "lastName": "Smith",
+
        "company": "{company}"
    "middleName": "",
+
      },
    "phone1": "555-555-5501",
+
      "address": {
    "phone2": "",
+
        "street1": "{street1}",
    "postalCode": "60001",
+
        "street2": "{street2}",
    "stateOrProvince": "IL",
+
        "city": "{city}",
    "street1": "100 Main St.",
+
        "stateOrProvince": "{stateOrProvince}",
     "street2": ""
+
        "postalCode": "{postalCode}",
 +
        "countryCode": "{countryCode}"
 +
      },
 +
      "contactMedia": {
 +
        "phone1": "{phone1}",
 +
        "phone2": "{phone2}",
 +
        "fax": "{fax}",
 +
        "email1": "{email1}",
 +
        "email2": "{email2}",
 +
        "emailVerified": {emailverified}
 +
      }
 +
    },
 +
     "billing": {
 +
      ...
 +
    },
 +
    "administrator": {
 +
      ...
 +
    },
 +
    "technical": {
 +
      ...
 +
    }
 
   },
 
   },
   "billing": {
+
   "links": [
     "city": "Chicago",
+
     {
    "countryCode": "US",
+
      "href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/contacts/",
    "email1": "test@test.com",
+
      "rel": "self"
    "email2": "",
+
     }
    "fax": "",
+
   ]
    "firstName": "John",
+
    "lastName": "Smith",
+
    "middleName": "",
+
    "phone1": "555-555-5501",
+
    "phone2": "",
+
    "postalCode": "60001",
+
    "stateOrProvince": "IL",
+
    "street1": "100 Main St.",
+
    "street2": ""
+
  },
+
  "administrator": {
+
    "city": "Chicago",
+
    "countryCode": "US",
+
     "email1": "test@test.com",
+
    "email2": "",
+
    "fax": "",
+
    "firstName": "John",
+
    "lastName": "Smith",
+
    "middleName": "",
+
    "phone1": "555-555-5501",
+
    "phone2": "",
+
    "postalCode": "60001",
+
    "stateOrProvince": "IL",
+
    "street1": "100 Main St.",
+
    "street2": ""
+
  },
+
   "technical": {
+
    "city": "Chicago",
+
    "countryCode": "US",
+
    "email1": "test@test.com",
+
    "email2": "",
+
    "fax": "",
+
    "firstName": "John",
+
    "lastName": "Smith",
+
    "middleName": "",
+
    "phone1": "555-555-5501",
+
    "phone2": "",
+
    "postalCode": "60001",
+
    "stateOrProvince": "IL",
+
    "street1": "100 Main St.",
+
    "street2": ""
+
  }
+
 
}
 
}
 
  </nowiki>
 
  </nowiki>
 +
 +
==== Parameters ====
 +
Note, there are 4 types of contact information that must be returned with the response: "regular", "billing", "administrator" and "technical".
 +
 +
; city - ''string''
 +
: May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
 +
 +
; company - ''string''
 +
: ''(OPTIONAL)''
 +
: May be up to 200 characters long. May contain only alphanumerics, white space and the following characters: -.'
 +
 +
; countryCode - ''string''
 +
: ISO 3166-1 alpha-2[http://www.iso.org/iso/iso-3166-1_decoding_table.html] country code.
 +
 +
; email1 - ''string''
 +
: May be up to 100 characters long. Must contain a valid e-mail address.
 +
 +
; email2 - ''string''
 +
: ''(OPTIONAL)''
 +
: May be up to 100 characters long. If provided, must contain a valid e-mail address.
 +
 +
; emailVerified - ''integer''
 +
: Provides information whether the '''email''' is verified for a Zendesk access. Valid values are '''0''' or '''1'''.
 +
 +
; fax - ''string''
 +
: ''(OPTIONAL)''
 +
: May be up to 20 characters long. If provided, must contain ITU-T E.164[http://www.itu.int/rec/T-REC-E.164/en] formatted phone number.
 +
 +
; firstName - ''string''
 +
: May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
 +
 +
; lastName - ''string''
 +
: May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
 +
 +
; middleName - ''string''
 +
: ''(OPTIONAL)''
 +
: May be up to 50 characters long. If provided, may contain only alphanumerics, white space and the following characters: -.'
 +
 +
; phone1 - ''string''
 +
: May be up to 20 characters long. Must contain ITU-T E.164[http://www.itu.int/rec/T-REC-E.164/en] formatted phone number.
 +
 +
; phone2 - ''string''
 +
: ''(OPTIONAL)''
 +
: May be up to 20 characters long. If provided, must contain ITU-T E.164[http://www.itu.int/rec/T-REC-E.164/en] formatted phone number.
 +
 +
; postalCode - ''string''
 +
: ''(OPTIONAL)''
 +
: May be up to 30 characters long. May contain only alphanumerics, white space and the following characters: -.' This value is *required* if the value of ''countryCode'' is "US" or "CA". If the value of ''countryCode'' is "US", then ''postalCode'' must be in format "#####" or "#####-####" (where "#" represents any numeric digit). If the value of ''countryCode'' is "CA", then ''postalCode'' must be in format "A#A#A#" or "A#A-#A#" or "A#A #A#" (where "A" represents any latin alphabet character and "#" represents any numeric digit).
 +
 +
; salutation - ''string''
 +
: ''(OPTIONAL)''
 +
: May contain one of the salutations provided by [[Salutations:GET|GET /salutations]]
 +
 +
; stateOrProvince - ''string''
 +
: ''(OPTIONAL)''
 +
: May be up to 20 characters long. May contain only alphanumerics, white space and the following characters: -.' This value is *required* if the value of ''countryCode'' is "US" or "CA". If the value of ''countryCode'' is "US", then ''stateOrProvince'' must be a valid two-letter US state abbreviation. If the value of ''countryCode'' is "CA", then ''stateOrProvince'' must be a valid two-letter Canadian province abbreviation.
 +
 +
; street1 - ''string''
 +
: May be up to 100 characters long. May contain only alphanumerics, white space and the following characters: -.'
 +
 +
; street2 - ''string''
 +
: ''(OPTIONAL)''
 +
: May be up to 100 characters long. If provided, may contain only alphanumerics, white space and the following characters: -.'
  
 
== Examples ==
 
== Examples ==
Line 108: Line 155:
 
200 OK
 
200 OK
  
[
+
{
  {
+
  "contactInfo": {
       "City": "Chicago",  
+
    "regular": {
      "FirstName": "John",  
+
       "name": {
      "LastName": "Smith",  
+
        "salutation": "Mr.",
      "State": "IL",  
+
        "firstName": "John",
      "Email": "test@test.com",  
+
        "middleName": "",
       "Fax": "",  
+
        "lastName": "Smith",
      "Zip": "60001",  
+
        "company": "TestCo, Inc."
      "Deleted": 0,  
+
      },
      "Company": "Hostway co",  
+
       "address": {
      "Phone": "555-555-5501",  
+
        "street1": "100 Main St.",
      "ContactType": "billing",  
+
        "street2": "",
       "AccountId": 100144677,
+
        "city": "Chicago",
      "Phone2Clean": "",  
+
        "stateOrProvince": "IL",
      "MiddleName": "",  
+
        "postalCode": "60001",
      "Country": "US",  
+
        "countryCode": "US"
      "AccountNumber": "test-account11111",  
+
      },
      "PhoneClean": "5555555501",  
+
       "contactMedia": {
      "Agent": "n/a",
+
        "phone1": "555-555-5501",
       "Id": 100429415,
+
        "phone2": "",
       "Phone2": "",
+
        "fax": "",
      "Street": "100 Main St.",  
+
        "email1": "test@test.com",
      "Email2": "",  
+
        "email2": "",
      "Street2": ""
+
        "emailVerified": 1
  },
+
       }
  {
+
    },
      "City": "Chicago",  
+
    "billing": {
      "FirstName": "John",  
+
       "name": {
       "LastName": "Smith",  
+
        "salutation": "Mr.",
      "State": "IL",  
+
        "firstName": "John",
      "Email": "test@test.com",  
+
        "middleName": "",
      "Fax": "",  
+
        "lastName": "Smith",
      "Zip": "60001",  
+
        "company": "TestCo, Inc."
      "Deleted": 0,  
+
      },
       "Company": "Hostway co",
+
       "address": {
      "Phone": "555-555-5501",  
+
        "street1": "100 Main St.",
      "ContactType": "regular",  
+
        "street2": "",
      "AccountId": 100144677,  
+
        "city": "Chicago",
      "Phone2Clean": "",  
+
        "stateOrProvince": "IL",
      "MiddleName": "",  
+
        "postalCode": "60001",
      "Country": "US",  
+
        "countryCode": "US"
      "AccountNumber": "test-account11111",
+
      },
       "PhoneClean": "5555555501",
+
       "contactMedia": {
      "Agent": "n/a",  
+
        "phone1": "555-555-5501",
      "Id": 100429416,
+
        "phone2": "",
      "Phone2": "",  
+
        "fax": "",
      "Street": "100 Main St.",  
+
        "email1": "test@test.com",
      "Email2": "",  
+
        "email2": "",
      "Street2": ""
+
        "emailVerified": 1
  },
+
      }
  {
+
    },
       "City": "Chicago",
+
    "administrator": {
      "FirstName": "John",  
+
       "name": {
      "LastName": "Smith",  
+
        "salutation": "Mr.",
      "State": "IL",  
+
        "firstName": "John",
      "Email": "test@test.com",  
+
        "middleName": "",
      "Fax": "",  
+
        "lastName": "Smith",
      "Zip": "60001",
+
        "company": "TestCo, Inc."
       "Deleted": 0,  
+
      },
       "Company": "Hostway co",
+
       "address": {
      "Phone": "555-555-5501",  
+
        "street1": "100 Main St.",
      "ContactType": "administrator",  
+
        "street2": "",
      "AccountId": 100144677,  
+
        "city": "Chicago",
      "Phone2Clean": "",  
+
        "stateOrProvince": "IL",
      "MiddleName": "",  
+
        "postalCode": "60001",
      "Country": "US",  
+
        "countryCode": "US"
      "AccountNumber": "test-account11111",
+
       },
       "PhoneClean": "5555555501",
+
       "contactMedia": {
      "Agent": "n/a",  
+
        "phone1": "555-555-5501",
      "Id": 100429417,
+
        "phone2": "",
      "Phone2": "",  
+
        "fax": "",
      "Street": "100 Main St.",  
+
        "email1": "test@test.com",
      "Email2": "",  
+
        "email2": "",
      "Street2": ""
+
        "emailVerified": 1
  },
+
      }
  {
+
    },
       "City": "Chicago",
+
    "technical": {
      "FirstName": "John",  
+
       "name": {
      "LastName": "Smith",  
+
        "salutation": "Mr.",
      "State": "IL",  
+
        "firstName": "John",
      "Email": "test@test.com",  
+
        "middleName": "",
      "Fax": "",  
+
        "lastName": "Smith",
      "Zip": "60001",
+
        "company": "TestCo, Inc."
       "Deleted": 0,  
+
      },
       "Company": "Hostway co",
+
       "address": {
      "Phone": "555-555-5501",  
+
        "street1": "100 Main St.",
      "ContactType": "technical",  
+
        "street2": "",
      "AccountId": 100144677,
+
        "city": "Chicago",
      "Phone2Clean": "",  
+
        "stateOrProvince": "IL",
      "MiddleName": "",  
+
        "postalCode": "60001",
      "Country": "US",  
+
        "countryCode": "US"
      "AccountNumber": "test-account11111",
+
       },
       "PhoneClean": "5555555501",
+
       "contactMedia": {
      "Agent": "n/a",  
+
        "phone1": "555-555-5501",
      "Id": 100429418,
+
        "phone2": "",
       "Phone2": "",
+
        "fax": "",
      "Street": "100 Main St.",  
+
        "email1": "test@test.com",
       "Email2": "",
+
        "email2": "",
      "Street2": ""
+
        "emailVerified": 1
  }
+
       }
]
+
    }
 +
  },
 +
  "links": [
 +
    {
 +
       "href": "https://api.hostway.com/accounts/{accountId}/contacts/",
 +
       "rel": "self"
 +
    }
 +
  ]
 +
}
 
  </nowiki>
 
  </nowiki>
  
Line 225: Line 280:
 
{
 
{
 
   "itemNotFound": {
 
   "itemNotFound": {
 +
      "guid": {identifier},
 
       "message": "/accounts/fake-account-id/contacts",  
 
       "message": "/accounts/fake-account-id/contacts",  
 
       "code": 404,  
 
       "code": 404,  

Latest revision as of 09:07, 14 October 2014

GET /accounts/{accountId}/contacts

Get contact details for an account.

Contents


Request

GET /accounts/{accountId}/contacts

Request Parameters

accountId - string
The unique account Id.

URI Parameters

None.

Request Headers

Authorization - HTTP Authorization header [1]
The Authentication credentials of the client application.

Response

Status Code

200 OK
Success
401 Unauthorized
The request was sent without an Authorization header, or the user represented by the value of this header was not properly authenticated.
403 Forbidden
The user authenticated for this request is not allowed to access the resource.
404 Not Found
The specified account Id does not exist or is purged.

Response Body

{
  "contactInfo": {
    "regular": {
      "name": {
        "salutation": "{salutation}",
        "firstName": "{firstname}",
        "middleName": "{middleName}",
        "lastName": "{lastName}",
        "company": "{company}"
      },
      "address": {
        "street1": "{street1}",
        "street2": "{street2}",
        "city": "{city}",
        "stateOrProvince": "{stateOrProvince}",
        "postalCode": "{postalCode}",
        "countryCode": "{countryCode}"
      },
      "contactMedia": {
        "phone1": "{phone1}",
        "phone2": "{phone2}",
        "fax": "{fax}",
        "email1": "{email1}",
        "email2": "{email2}",
        "emailVerified": {emailverified}
      }
    },
    "billing": {
      ...
    },
    "administrator": {
      ...
    },
    "technical": {
      ...
    }
  },
  "links": [
    {
      "href": "https://api.hostway.com/accounts/{accountId}/contacts/",
      "rel": "self"
    }
  ]
}
 

Parameters

Note, there are 4 types of contact information that must be returned with the response: "regular", "billing", "administrator" and "technical".

city - string
May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
company - string
(OPTIONAL)
May be up to 200 characters long. May contain only alphanumerics, white space and the following characters: -.'
countryCode - string
ISO 3166-1 alpha-2[2] country code.
email1 - string
May be up to 100 characters long. Must contain a valid e-mail address.
email2 - string
(OPTIONAL)
May be up to 100 characters long. If provided, must contain a valid e-mail address.
emailVerified - integer
Provides information whether the email is verified for a Zendesk access. Valid values are 0 or 1.
fax - string
(OPTIONAL)
May be up to 20 characters long. If provided, must contain ITU-T E.164[3] formatted phone number.
firstName - string
May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
lastName - string
May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
middleName - string
(OPTIONAL)
May be up to 50 characters long. If provided, may contain only alphanumerics, white space and the following characters: -.'
phone1 - string
May be up to 20 characters long. Must contain ITU-T E.164[4] formatted phone number.
phone2 - string
(OPTIONAL)
May be up to 20 characters long. If provided, must contain ITU-T E.164[5] formatted phone number.
postalCode - string
(OPTIONAL)
May be up to 30 characters long. May contain only alphanumerics, white space and the following characters: -.' This value is *required* if the value of countryCode is "US" or "CA". If the value of countryCode is "US", then postalCode must be in format "#####" or "#####-####" (where "#" represents any numeric digit). If the value of countryCode is "CA", then postalCode must be in format "A#A#A#" or "A#A-#A#" or "A#A #A#" (where "A" represents any latin alphabet character and "#" represents any numeric digit).
salutation - string
(OPTIONAL)
May contain one of the salutations provided by GET /salutations
stateOrProvince - string
(OPTIONAL)
May be up to 20 characters long. May contain only alphanumerics, white space and the following characters: -.' This value is *required* if the value of countryCode is "US" or "CA". If the value of countryCode is "US", then stateOrProvince must be a valid two-letter US state abbreviation. If the value of countryCode is "CA", then stateOrProvince must be a valid two-letter Canadian province abbreviation.
street1 - string
May be up to 100 characters long. May contain only alphanumerics, white space and the following characters: -.'
street2 - string
(OPTIONAL)
May be up to 100 characters long. If provided, may contain only alphanumerics, white space and the following characters: -.'

Examples

Successful Request

Request

GET /accounts/{accountId}/contacts
Authorization: Basic {Base64-encoded username & password string}
 

Response

200 OK

{
  "contactInfo": {
    "regular": {
      "name": {
        "salutation": "Mr.",
        "firstName": "John",
        "middleName": "",
        "lastName": "Smith",
        "company": "TestCo, Inc."
      },
      "address": {
        "street1": "100 Main St.",
        "street2": "",
        "city": "Chicago",
        "stateOrProvince": "IL",
        "postalCode": "60001",
        "countryCode": "US"
      },
      "contactMedia": {
        "phone1": "555-555-5501",
        "phone2": "",
        "fax": "",
        "email1": "test@test.com",
        "email2": "",
        "emailVerified": 1
      }
    },
    "billing": {
      "name": {
        "salutation": "Mr.",
        "firstName": "John",
        "middleName": "",
        "lastName": "Smith",
        "company": "TestCo, Inc."
      },
      "address": {
        "street1": "100 Main St.",
        "street2": "",
        "city": "Chicago",
        "stateOrProvince": "IL",
        "postalCode": "60001",
        "countryCode": "US"
      },
      "contactMedia": {
        "phone1": "555-555-5501",
        "phone2": "",
        "fax": "",
        "email1": "test@test.com",
        "email2": "",
        "emailVerified": 1
      }
    },
    "administrator": {
      "name": {
        "salutation": "Mr.",
        "firstName": "John",
        "middleName": "",
        "lastName": "Smith",
        "company": "TestCo, Inc."
      },
      "address": {
        "street1": "100 Main St.",
        "street2": "",
        "city": "Chicago",
        "stateOrProvince": "IL",
        "postalCode": "60001",
        "countryCode": "US"
      },
      "contactMedia": {
        "phone1": "555-555-5501",
        "phone2": "",
        "fax": "",
        "email1": "test@test.com",
        "email2": "",
        "emailVerified": 1
      }
    },
    "technical": {
      "name": {
        "salutation": "Mr.",
        "firstName": "John",
        "middleName": "",
        "lastName": "Smith",
        "company": "TestCo, Inc."
      },
      "address": {
        "street1": "100 Main St.",
        "street2": "",
        "city": "Chicago",
        "stateOrProvince": "IL",
        "postalCode": "60001",
        "countryCode": "US"
      },
      "contactMedia": {
        "phone1": "555-555-5501",
        "phone2": "",
        "fax": "",
        "email1": "test@test.com",
        "email2": "",
        "emailVerified": 1
      }
    }
  },
  "links": [
    {
      "href": "https://api.hostway.com/accounts/{accountId}/contacts/",
      "rel": "self"
    }
  ]
}
 

Request for non-existent account Id

Request

GET /accounts/{fake_account_number}/contacts
Authorization: Basic {Base64-encoded username & password string}
 

Response

404 Not Found

{
   "itemNotFound": {
      "guid": {identifier},
      "message": "/accounts/fake-account-id/contacts", 
      "code": 404, 
      "details": ""
   }
}
 

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox