PARAM_PER_PAGE
PARAM_PER_PAGE
Name of the parameter controlling the number of responses per page
An object to handle interactions with the Canvas API.
For more information on the Canvas API refer to the offical Canvas API documentation or to the (slightly more up-to-date and pleasingly interactive) live documentation.
You can access the live documentation for your own Canvas instance and make
actual API calls to it at https://<path-to-your-instance>/doc/api/live
__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()) : \smtech\CanvasPest\CanvasObject|false
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 |
put(string $path, string|array<mixed,string> $data = array(), string|array<mixed,string> $headers = array()) : \smtech\CanvasPest\CanvasObject|false
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 |
delete(string $path, string|array<mixed,string> $data = array(), string|array<mixed,string> $headers = array()) : \smtech\CanvasPest\CanvasObject|false
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 |
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
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 |