/**
  * Requests and returns the response 
  * for the fields endpoint in the API.
  *
  * @return GuzzleHttp\Psr7\Response
  **/
 public static function requestAvailableFields()
 {
     $client = HttpClientService::getHttpClient();
     $response = null;
     $accessToken = OAuthClientService::getAccessToken();
     $response = $client->request('GET', 'fields', array('headers' => array('Authorization' => 'Bearer ' . $accessToken, 'Accept' => 'application/json')));
     return $response;
 }
 /**
  * Sends an upload request to the API.
  *
  * @param Array 	The json convertible array of 
  * 				the people to be uploaded
  *
  * @throws ClientException | ServerException | Exception
  *
  * @return GuzzleHttp\Psr7\Response
  **/
 public static function requestUpload($peopleUploadJson)
 {
     $client = HttpClientService::getHttpClient();
     $response = null;
     $accessToken = OAuthClientService::getAccessToken();
     $response = $client->request('POST', 'person', array('headers' => array('Authorization' => 'Bearer ' . $accessToken, 'Content-Type' => 'application/json', 'Accept' => 'application/json'), 'json' => $peopleUploadJson));
     return $response;
 }
 /**
  * Tests the Forbidden behaviour when 
  * a wrong accessToken is provided to a protected endpoint
  **/
 public function testForbiddenFieldsRequest()
 {
     $client = HttpClientService::getHttpClient();
     $accessToken = OAuthClientService::getAccessToken();
     $response = null;
     $this->assertNotNull($client);
     $this->assertNotNull($accessToken);
     try {
         $response = $client->request('GET', 'fields', array('headers' => array('Authorization' => 'Bearer Non valid Token', 'Accept' => 'application/json')));
     } catch (ClientException $e) {
         $response = $e->getResponse();
     }
     $this->assertNotNull($response);
     $this->assertResponseUnauthorized($response);
 }