1. Home
  2. Knowledge Base
  3. API
  4. GET: Retrieving Data

GET: Retrieving Data

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);
?>
Was this article helpful?

Related Articles

Contents

Need Support?

Can't find the answer you're looking for?
Contact Support