Overview

Namespaces

  • ApiAxle
    • Api
    • Shared
  • ApiAxleTest
    • Api
    • Shared
  • PHP

Classes

  • Api
  • Key
  • Keyring
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo

Class Api

ApiAxle\Api\Api class

Wraps API related calls to the ApiAxle API

Namespace: ApiAxle\Api
Author: Phillip Shipley <phillip@phillipshipley.com>
Located at src/ApiAxle/Api/Api.php
Methods summary
public
# __construct( array $config = false, string $name = false )

Construct new Api object.

Construct new Api object.

If a $name is provided, it will be fetched from the ApiAxle API and properties will be set accordingly.

Parameters

$config
array
$config
$name
string
$name
public ApiAxle\Api\Api
# setData( type $data )

Set object properties

Set object properties

Parameters

$data
type
$data

Returns

ApiAxle\Api\Api
public array
# getData( )

Get API settings as array

Get API settings as array

Returns

array
public
# setName( string $name )

Set the API name

Set the API name

Parameters

$name
string
$name
public string
# getName( )

Get the API name

Get the API name

Returns

string
public ApiAxle\Shared\ItemList
# getList( mixed $from = 0, mixed $to = 100, mixed $resolve = 'true' )

Call API to retrieve a list of available APIs

Call API to retrieve a list of available APIs

Returns

ApiAxle\Shared\ItemList
public ApiAxle\Api\Api
# get( string $name )

Fetch information about the API from the server and update object properties with information from ApiAxle

Fetch information about the API from the server and update object properties with information from ApiAxle

Parameters

$name
string
$name

Returns

ApiAxle\Api\Api
public
# update( array $data )

Update the current API

Update the current API

Parameters

$data
array
$data

Throws

ErrorException
201 - Missing API name, cant make update call
public ApiAxle\Api\Api
# create( string $name, array $data )

Register a new API

Register a new API

Parameters

$name
string
$name
$data
array
$data

Returns

ApiAxle\Api\Api

Throws

ErrorException
public boolean
# delete( string $name = false )

Delete an API

Delete an API

Parameters

$name
string
$name

Returns

boolean

Throws

Exception
ErrorException
public stdClass
# getKeyCharts( integer $timestart = false, integer $timeend = false, string $granularity = 'day', string $format_timeseries = 'true', string $format_timestamp = 'epoch_seconds' )

Get the most used keys for this api

Get the most used keys for this api

Parameters

$timestart
integer
$timestart
$timeend
integer
$timeend
$granularity
string
$granularity Valid options: second, minute, hour, day
$format_timeseries
string
$format_timeseries
$format_timestamp
string
$format_timestamp Valid options: epoch_seconds, epoch_milliseconds, ISO

Returns

stdClass

Throws

Exception
ErrorException

Todo

Create new class to represent keycharts data
public ApiAxle\Shared\ItemList
# getKeyList( integer $from = 0, integer $to = 100, string $resolve = 'true' )

Get a list of Keys with access to this API

Get a list of Keys with access to this API

Parameters $from and $to are used for paginating through results

Parameters

$from
integer
$from Default is 0
$to
integer
$to Default is 100
$resolve
string
$resolve Wether or not get Key details. Default is 'true'

Returns

ApiAxle\Shared\ItemList

Throws

Exception
ErrorException
public ApiAxle\Api\Api
# linkKey( ApiAxle\Api\Key $key )

Link a Key to this Api

Link a Key to this Api

Parameters

$key
ApiAxle\Api\Key
$key

Returns

ApiAxle\Api\Api

Throws

Exception
public ApiAxle\Api\Api
# unLinkKey( ApiAxle\Api\Key $key )

Unlink a Key from this API

Unlink a Key from this API

Parameters

$key
ApiAxle\Api\Key
$key

Returns

ApiAxle\Api\Api

Throws

Exception
public stdClass
# getStats( integer $timestart = false, integer $timeend = false, string $granularity = 'minute', string $format_timeseries = 'true', string $format_timestamp = 'epoch_seconds', ApiAxle\Api\Key $forkey = false )

Get stats for this API

Get stats for this API

Parameters

$timestart
integer
$timestart
$timeend
integer
$timeend
$granularity
string
$granularity Options are second, minute, hour, day
$format_timeseries
string
$format_timeseries String of either 'true' or 'false'
$format_timestamp
string
$format_timestamp Default: epoch_seconds
$forkey
ApiAxle\Api\Key
$forkey Limit results to a single Key

Returns

stdClass
Object representing results from API

Throws

Exception
public stdClass
# getCharts( string $granularity = 'minute' )

Get the most used APIs and their hit counts

Get the most used APIs and their hit counts

Parameters

$granularity
string
$granularity Options are second, minute, hour, day

Returns

stdClass

Throws

Exception
public ApiAxle\Shared\Config
# getConfig( )

Get current config object

Get current config object

Returns

ApiAxle\Shared\Config
public boolean
# isValid( )

Check if required fields are present for provisioning new API

Check if required fields are present for provisioning new API

Returns

boolean

Throws

Exception
Properties summary
protected ApiAxle\Shared\Config $config
#

Configuration data

Configuration data

protected string $name
#

API Name

API Name

protected timestamp $createdAt
#

Optional

Optional

protected timestamp $updatedAt
#

Optional

Optional

protected integer $globalCache 0
#

(default: 0) The time in seconds that every call under this API should be cached.

(default: 0) The time in seconds that every call under this API should be cached.

protected string $endPoint
#

The endpoint for the API. For example; graph.facebook.com

The endpoint for the API. For example; graph.facebook.com

protected string $protocol 'http'
#

(default: http) The protocol for the API, whether or not to use SSL

(default: http) The protocol for the API, whether or not to use SSL

protected string $apiFormat 'json'
#

(default: json) The resulting data type of the endpoint. This is redundant at the moment but will eventually support both XML too.

(default: json) The resulting data type of the endpoint. This is redundant at the moment but will eventually support both XML too.

protected integer $endPointTimeout '2'
#

(default: 2) Seconds to wait before timing out the connection

(default: 2) Seconds to wait before timing out the connection

protected integer $endPointMaxRedirects '2'
#

(default: 2) Max redirects that are allowed when endpoint called.

(default: 2) Max redirects that are allowed when endpoint called.

protected string $extractKeyRegex
#

(optional) Regular expression used to extract API key from url. Axle will use the first matched grouping and then apply that as the key. Using the api_key or apiaxle_key will take precedence.

(optional) Regular expression used to extract API key from url. Axle will use the first matched grouping and then apply that as the key. Using the api_key or apiaxle_key will take precedence.

protected string $defaultPath
#

(optional) An optional path part that will always be called when the API is hit.

(optional) An optional path part that will always be called when the API is hit.

protected boolean $disabled 'false'
#

(default: false) Disable this API causing errors when it's hit

(default: false) Disable this API causing errors when it's hit

protected boolean $strictSSL 'true'
#

(default: true) Set to true to require that SSL certificates be valid

(default: true) Set to true to require that SSL certificates be valid

fillup/apiaxle API documentation generated by ApiGen 2.8.0