Ejemplo n.º 1
0
 /**
  * TODO: type endpoint description here
  * @param  string  $userID        Required parameter: TODO: type description here
  * @param  string  $contactListID Required parameter: TODO: type description here
  * @param  Contact $body          Required parameter: TODO: type description here
  * @return void    response from the API call*/
 public function addContact($userID, $contactListID, $body)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::baseUri();
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/v3/users/{User ID}/contact_lists/{Contact List ID}/contacts';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('User ID' => $userID, 'Contact List ID' => $contactListID));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('User-Agent' => 'APIMATIC 2.0', 'Authorization' => sprintf('Bearer %1$s', Configuration::token()));
     //prepare API request
     $response = Request::post($queryUrl, $headers, json_encode($body));
     //Error handling using HTTP status codes
     if ($response->code < 200 || $response->code > 206) {
         //[200,206] = HTTP OK
         throw new APIException("HTTP Response code: " . $response->code . ". " . $response->body->error_description, $response->code);
     }
 }
Ejemplo n.º 2
0
 /**
  * TODO: type endpoint description here
  * @param  string $eventID Required parameter: TODO: type description here
  * @param  string $teamID  Required parameter: TODO: type description here
  * @return void   response from the API call*/
 public function getTeamAttendees($eventID, $teamID)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::baseUri();
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/v3/events/{Event ID}/teams/{Team ID}/attendees/';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('Event ID' => $eventID, 'Team ID' => $teamID));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('User-Agent' => 'APIMATIC 2.0', 'Authorization' => sprintf('Bearer %1$s', Configuration::token()));
     //prepare API request
     $response = Request::get($queryUrl, $headers);
     //Error handling using HTTP status codes
     if ($response->code < 200 || $response->code > 206) {
         //[200,206] = HTTP OK
         throw new APIException("HTTP Response code: " . $response->code . ". " . $response->body->error_description, $response->code);
     }
 }