Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

The Club OS API uses HTTPS URLs to access its services.  

  1. Here is a good article on REST concepts if you are not familiar.   
  2. You should also understand the JSON data format as all request data must be sent as valid JSON

Authentication

Club OS will provide you a username and password when you register for the API.  Here is a good reference for HTTP Basic Auth, which you must use for all requests.

You must also make sure to specify the Content-Type header to be "application/json" or your request will not succeed.

UNIX Timestamp

Unless otherwise specified, all DateTimes that are sent and received from the Club OS webservices will be in standard UNIX Timestamp format, as shown below.

yyyy-MM-dd'T'HH:mm:ss.SSS'Z'

Response

The Club OS API will respond to requests with a generic JSON Response object.

PropertyTypeDescription
statusBooleantrue if the request was successful, false if errors.
responsesResponseMessage[]An array of ResponseMessage objects (see below).

ResponseMessage

PropertyTypeDescription
messageStringA message describing what happened to the resource.
valueStringThe id of the resource.
Using the ResponseMessage value property

The value property will contain the Club OS unique id for the resource you are creating or updating.

...

After a successful request, you should save this value in your database with the associated user.  Then you can use them on subsequent requests.  The unique id's ensure that our systems stay in-sync throughout the existence of the resource you are dealing with (users, memberships, club services, and payments).  

Examples

Feel free to use any library or language you wish.  If you would like to share your code once it works, please email support@club-os.com and they will post it here.

...

This example shows how to post a prospect to Club OS via PHP (Wordpress, Facebook, etc..)

 

Code Block
languagejava
themeEclipse
    $post_url = 'https://api.club-os.com/prospects?clubLocationId=[clubLocationId]';
    
    $body = array(
        'firstName' => $first_name, 
        'lastName' => $last_name, 
        'email' => $email,
	    'mobilePhone' => $mobile_phone,
        'notes' => $notes,
        'source' => $source,
        'gender' => 'M' 
    );  
    $body_json = json_encode($body);

    $args = array(
	    'headers' => array(
		       'Authorization' => 'Basic ' . base64_encode( '[username]' . ':' . '[password]' ), 
		       'Content-type' => 'application/json'
	    ),
	    'body' => $body_json,
        'sslverify' => false
    );
 
    $resp = wp_remote_post( $post_url, $args );

 


JAVA

This example uses the Jersey library which can be downloaded here.

...