1. Home
  2. API
  3. GET: Retrieving Data

GET: Retrieving Data

Contents

The GET method is most probably going to be the most used method when using the API. It allows you to retrieve data specific to a resource.

Syntax

$response = $api->get($resource [, $data]);

Where:

  • $resource – an API resource (i.e. /levels)
  • $data – (optional) an associative array of data to pass to the API

Returns:

$response – string: can be either serialized PHP data, JSON or XML

Example

To retrieve a list of all membership levels

<?php
$response = $api->get('/levels');
// we unserialize the response because we're using PHP as return format
$response = unserialize($response);
// dump the response to output
print_r($response);
?>

To retrieve details of a particular membership level

<?php
$level_id = 1234567890;
$response = $api->get('/levels/'.$level_id);
// we unserialize the response because we're using PHP as return format
$response = unserialize($response);
// dump the response to output
print_r($response);
?>
Updated on July 11, 2018

Was this article helpful?

Related Articles

Not the solution you were looking for?
Click the link below to submit a support ticket
Submit Ticket