PARAM_PER_PAGE
PARAM_PER_PAGE
Name of the parameter controlling the number of responses per page
Treat the API as read-only.
Without excessive editorializing, the permissions structure in Canvas bites. For example, one can't create a user who has read-only access to the complete API -- if a user has complete access to the API, they have complete access to the API, including the ability to alter and delete information. This object provides a comparative level of safety, enforcing a restriction on GET-only API calls.
__construct(string $apiInstanceUrl, string $apiAuthorizationToken = null)
Construct a new CanvasPest
string | $apiInstanceUrl | URL of the API instance (e.g.
|
string | $apiAuthorizationToken | (Optional) API access token for the API instance (if not provided now, it will need to be provided later) |
get(string $path, string|array<mixed,string> $data = array(), string|array<mixed,string> $headers = array()) : \smtech\CanvasPest\CanvasObject|\smtech\CanvasPest\CanvasArray|false
Make a GET call to the API
For queries to individually identified endpoints (e.g.
accounts/1/users/123
), return a CanvasObject representing the API response
describing that individually identified object affected by the query.
For queries to generic endpoints (e.g. accounts/1/users
), return a
traversable CanvasArray (of CanvasObjects) representing the API response
describing the list of objects affected by the query.
string | $path | Path to the API endpoint of this call |
string|array<mixed,string> | $data | (Optional) Query parameters for this call |
string|array<mixed,string> | $headers | (Optional) Any additional HTTP headers for this call |
post(string $path, string|array<mixed,string> $data = array(), string|array<mixed,string> $headers = array()) : void
Make a POST call to the API
For queries to individually identified endpoints (e.g.
accounts/1/users/123
), return a CanvasObject representing the API response
describing that individually identified object affected by the query.
string | $path | Path to the API endpoint of this call |
string|array<mixed,string> | $data | (Optional) Query parameters for this call |
string|array<mixed,string> | $headers | (Optional) Any additional HTTP headers for this call |
IMMUTABLE All calls to this method will cause an exception
put(string $path, string|array<mixed,string> $data = array(), string|array<mixed,string> $headers = array()) : void
Make a PUT call to the API
For queries to individually identified endpoints (e.g.
accounts/1/users/123
), return a CanvasObject representing the API response
describing that individually identified object affected by the query.
string | $path | Path to the API endpoint of this call |
string|array<mixed,string> | $data | (Optional) Query parameters for this call |
string|array<mixed,string> | $headers | (Optional) Any additional HTTP headers for this call |
IMMUTABLE All calls to this method will cause an exception
None found |
delete(string $path, string|array<mixed,string> $data = array(), string|array<mixed,string> $headers = array()) : void
Make a DELETE call to the API
For queries to individually identified endpoints (e.g.
accounts/1/users/123
), return a CanvasObject representing the API
response describing that individually identified object affected by
the query.
string | $path | Path to the API endpoint of this call |
string|array<mixed,string> | $data | (Optional) Query parameters for this call |
string|array<mixed,string> | $headers | (Optional) Any additional HTTP headers for this call |
IMMUTABLE All calls to this method will cause an exception
None found |
patch(string $path, string|array<mixed,string> $data = array(), string|array<mixed,string> $headers = array()) : false
Make a PATCH call to the API
string | $path | Path to the API endpoint of this call |
string|array<mixed,string> | $data | (Optional) Query parameters for this call |
string|array<mixed,string> | $headers | (Optional) Any additional HTTP headers for this call |
UNSUPPORTED_METHOD All calls to this method will cause an exception
None found |
prepHeaders(array<mixed,string> $headers) : array<mixed,string>
Prepare API request headers
Flatten headers from an associative array to a numerically indexed array
of "Name: Value"
style entries like CURLOPT_HTTPHEADER
expects.
Numerically indexed arrays are not modified.
Extended by CanvasPest to include the API access token in the
Authorization
header.
array<mixed,string> | $headers |
None found |
postprocessResponse(string $response) : \smtech\CanvasPest\CanvasObject|\smtech\CanvasPest\CanvasArray|false
Parse the API response into an object (or collection of objects).
For queries to individually identified endpoints (e.g.
accounts/1/users/123
), return a CanvasObject representing the API response
describing that individually identified object affected by the query.
For queries to generic endpoints (e.g. accounts/1/users
), return a
traversable CanvasArray (of CanvasObjects) representing the API response
describing the list of objects affected by the query.
string | $response | JSON-encoded response from the API |
INVALID_JSON_RESPONSE if an non-JSON-formatted response is received (and $this->throw_exceptions is true -- otherwise it returns false)
None found |
http_build_query(mixed $data) : string
Reformat query parameters for Canvas
Specifically, Canvas expects no numeric indices for base array parameters.
mixed | $data |
codingStandardsIgnoreStart |
---|
preprocessData(array<mixed,string> $data) : array<mixed,string>
Preprocess API call parameters before use
Force maximum response page size, if not already defined.
array<mixed,string> | $data | Array of parameters for the next API call |
Updated array of parameters
None found |