Client.php
public function post($resource, $content)
    {
        $url = $this->baseUrl . $resource;

        $headers = array(
            'Content-Type' => 'application/json',
            'Authorization' => $this->auth->getCredential()
        );

        try {
            $response = $this->browser->post($url, $headers, json_encode($content));
        } catch (\Buzz\Exception\ClientException $e) {
            throw new RequestException($e->getMessage());
        }

        if ($this->browser->getLastResponse()->getStatusCode() > 299) {
            throw new RequestException(json_decode($this->browser->getLastResponse()->getContent(), true));
        }

        return json_decode($response->getContent(), true);
    }
public function post($resource, $content)
    {
        $url = $this->baseUrl . $resource;

        $headers = array(
            'Content-Type' => 'application/json',
            'Authorization' => $this->auth->getCredential()
        );

        try {
            $response = $this->browser->post($url, $headers, json_encode($content));
        } catch (\Buzz\Exception\ClientException $e) {
            throw new RequestException($e->getMessage());
        }

        if ($this->browser->getLastResponse()->getStatusCode() > 299) {
            throw new RequestException(json_decode($this->browser->getLastResponse()->getContent(), true));
        }

        return json_decode($response->getContent(), true);
    }
public function post ( $ resource , $ content ) { $ url = $ this -> baseUrl . $ resource ; $ headers = array ( 'Content-Type' => 'application/json' , 'Authorization' => $ this -> auth -> getCredential ( ) ) ; try { $ response = $ this -> browser -> post ( $ url , $ headers , json_encode ( $ content ) ) ; } catch ( \ Buzz \ Exception \ ClientException $ e ) { throw new RequestException ( $ e -> getMessage ( ) ) ; } if ( $ this -> browser -> getLastResponse ( ) -> getStatusCode ( ) > 299 ) { throw new RequestException ( json_decode ( $ this -> browser -> getLastResponse ( ) -> getContent ( ) , true ) ) ; } return json_decode ( $ response -> getContent ( ) , true ) ; }
Common post request for all API calls

@param string $resource The path to the resource wanted. For example v2/room
@param array $content Parameters be posted for example:
array(
'name'                => 'Example name',
'privacy'             => 'private',
'is_archived'         => 'false',
'is_guest_accessible' => 'false',
'topic'               => 'New topic',
)

@return array Decoded array containing response
@throws Exception\RequestException
Common post request for all API calls