Versions Compared

Key

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

...

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

...

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

 

Code Block
languagejava
themeEclipselanguagejava
    $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 );

 

...

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

Code Block
languagejava
themeEclipselanguagejava
public class JerseyClientTest {
    	
    	Client client = Client.create();

    	client.addFilter(new HTTPBasicAuthFilter(username, password)); //Provided by Club OS

		WebResource webResource = client

		   .resource("https://api.club-os.com/users");

	    MultivaluedMap<String, String> params = new MultivaluedMapImpl();

	    params.add("clubLocationId", clubLocationId); //Provided by Club OS

		ClientResponse response = webResource.queryParams(params).type("application/json")

		   .post(ClientResponse.class, requestBody);

		String output = response.getEntity(String.class);
}

...