Documentation

InsightlyRequest
in package

API Requests class

Helper class for executing REST requests to the Insightly API.

Usage: - Instanciate: $request = new InsightlyRequest('GET', $apikey, 'create.../)

  • Execute: $request->toString();
  • Or implicitly execute: $request->asJSON();

Table of Contents

Constants

URL_BASE  = 'https://api.insight.ly'
API URL

Properties

$body  : string
Response body
$curl  : resource
CURL resource
$headers  : array<string|int, mixed>
Request headers
$querystrings  : array<string|int, mixed>
Request parameters
$url_path  : string
URL path outside the base URL

Methods

__construct()  : mixed
Request initialisation
asJSON()  : mixed
Return decoded JSON response
asString()  : string
Get executed request response
body()  : InsightlyRequest
Add data to the current request
queryParam()  : InsightlyRequest
Add query parameter to the current request
buildQueryString()  : string
Build query string for the current request
method()  : InsightlyRequest
Set request method

Constants

URL_BASE

API URL

public string URL_BASE = 'https://api.insight.ly'

Properties

$curl

CURL resource

private resource $curl

$headers

Request headers

private array<string|int, mixed> $headers

$querystrings

Request parameters

private array<string|int, mixed> $querystrings

$url_path

URL path outside the base URL

private string $url_path

Methods

__construct()

Request initialisation

public __construct(string $method, string $apikey, string $url_path) : mixed
Parameters
$method : string

(GET|DELETE|POST|PUT)

$apikey : string
$url_path : string
Tags
throws
Exception

asJSON()

Return decoded JSON response

public asJSON() : mixed
Tags
throws
Exception

asString()

Get executed request response

public asString([mixed $returnHeader = false ]) : string
Parameters
$returnHeader : mixed = false
Tags
throws
Exception
Return values
string

buildQueryString()

Build query string for the current request

private buildQueryString() : string
Return values
string

        
On this page

Search results