NAV Navbar
Logo
PHP

Introduction

Welcome to the Jobbers One API!

To use our API you have to contact Jobbers so that they can provide you with the credentials (API key and secret API key) to access these services.

The Jobbers API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors.

We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application (though you should never expose your secret API key in any public website’s client-side code). JSON is returned by all API responses, including errors.

We are using Authentication in all of our requests.

Take care that all this documentation refers to the endpoints without the base URL. You have to add it in every call. In general, it will be:

    REST base URL

    https://www.jobbers.com

Code examples

Examples in this documentation are provided in PHP code.

Regarding PHP, when explaining every endpoint we’ll use a call to the following functions:

All of them are based on cURL. These functions are described below.

PHP GET

This is a simple GET using cURL.

Note that:

<?php

function doGet($endpoint, $bearer) {

  $curl = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_URL => BASE_URL . $endpoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
      'Authorization: Bearer ' . $bearer
    ),
  ));

  //  exec the request
  $response = curl_exec($curl);
  $err = curl_error($curl);
  curl_close($curl);

  return array($err, $response);
}

//  When calling doGet:
list($err, $response) = doGet($url, ACCESS_TOKEN);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

PHP POST

This is a simple POST using cURL.

Note that:

<?php

function doPost($endpoint, $payload, $bearer = null) {

  $curl = curl_init();

  $headers = array();
  $headers[] = 'Content-type: application/json';
  if ($bearer != null) {
    $headers[] = 'Authorization: Bearer ' . $bearer;
  }

  curl_setopt_array($curl, array(
    CURLOPT_URL => BASE_URL . $endpoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => json_encode($payload),
    CURLOPT_HTTPHEADER => $headers
  ));

  //  exec the request
  $response = curl_exec($curl);
  $err = curl_error($curl);
  curl_close($curl);

  return array($err, $response);
}


//  When calling doPost:
list($err, $response) = doPost($url, $payload, ACCESS_TOKEN);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

PHP DELETE

This is a simple DELETE using cURL.

Note that:

<?php

function doDelete($endpoint, $bearer) {

  $curl = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_URL => BASE_URL . $endpoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => array(
      'Authorization: Bearer ' . $bearer
    ),
  ));

  $response = curl_exec($curl);
  $err = curl_error($curl);
  curl_close($curl);

  return array($err, $response);
}

//  when calling doDelete
list($err, $response) = doDelete($url, ACCESS_TOKEN);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Authentication

Jobbers API uses API keys to allow access to the API and encryption to protect the data sent. In fact, we are using a very light version of Oauth2 to authenticate users.

As Jobbers collaborator, you’ll be given an API key and an API secret key. You have to use both fields to authenticate yourself to a unique endpoint. Once authenticated you’ll be given an access_token valid for a certain time. You’ll have to provide this access_token in every other request authentication header.

Every time you’ll use this access_token, its expiration time will be renewed. Right now, we are not supporting a refresh_token, so if the token has expired you’ll be forced to authenticate again to get a new access_token.

Oauth2

Oauth2 is a simple mechanism that allows an API to authenticate users or grant access to third users. In our case, we are only authenticating direct users and that’s why the process is pretty simple.

  1. POST your API KEY and API SECRET KEY to our authentication endpoint
  2. Receive an access_token as response if all above fields are correct
  3. Use this access_token to authenticate the rest of call

Look the authentication area in this documentation for full understanding on this process.

Once you are given an access_token, you have to send it in all requests. Jobbers API expects for the access_token to be included in a header that looks like the following:

Authorization: Bearer ACCESS_TOKEN

GET /oneapi/v0/echo HTTP/1.1
Authorization: Bearer ACCESS_TOKEN
{
    "data": "echo"
}

<?php

... 

curl_setopt_array($curl, array(
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer ACCESS_TOKEN",
    ...
  ),
));

...

Errors

HTTP status

The Jobbers One API uses the following error codes:

Error Code Meaning
400 Bad Request – The server cannot process the request due to something perceived to be a client error
401 Unauthorized – Your API key / ACCESS_TOKEN is wrong
403 Forbidden – Not permitted to access this endpoint
404 Not Found – The specified endpoint cannot be found
405 Method Not Allowed – You tried to access and endpoint with an invalid method
422 Unprocessable Entity - The message cannot be decoded
500 Internal Server Error – An error occurred on our servers. Please try again later.
503 Service Unavailable – The service is temporarially offline (e.g., for maintenance). Please try again later.
<?php

//  If you need the retrieve the status code from a cURL operation:
...
$response = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
...

Error Names

When in 404, 405 and, especially, 400 the API can return a body with some help messages. These messages have the following structure:

{ "errors": [{ "title": "is_invalid", "source": "client", "detail": "client not found" }] }

It’s an array of errors containg objects composed by three components:

Field Meaning
title From a set of possible values: cannot_be_blank, has_already_been_taken, must_be_accepted, is_invalid, does_not_match, cannot_be_empty
source Field causing the error
detail A more human readable error message

Echo endpoints

These endpoints are for TESTING. You can use them to test authentication as they provide you with a simple API to test both of them.

Getting Echo

This endpoint is for TESTING purposes and it’s not ruled following REST standards as it just echoes the input given.

HTTP Request

GET /oneapi/v0/echo/{text}

GET /oneapi/v0/echo/hello+world HTTP/1.1
Authorization: Bearer ACCESS_TOKEN
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8

{
  "data": "echo hello world"
}

URL parameters

Parameter Mandatory Description
text No If set, the endpoint echoes the text.

Remember that URL parameters should always be urlencoded.

Response

The {text} passed in the URL parameter is output in the following format:

{ "data": "echo {text}" }

Posting Echo

This endpoint is for TESTING purposes and it’s not ruled following REST standards as it just echoes the input given.

HTTP Request

POST /oneapi/v0/echo

POST /oneapi/v0/echo HTTP/1.1
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

{
    "text": "hello world"
}
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
{
  "data": "echo hello world"
}

Body parameters (as JSON)

Parameter Mandatory Description
text No If set, the endpoint echoes the text.

Response

Same output as GET Echo.

(we know that this is not REST compliant, but these two endpoints are only for TESTING).

Authentication

Get Access Token

Sends the API key and API Secret Key to authenticate and receives an access_token to use in the rest of endpoints.

HTTP Request

POST /oneapi/authentication/token

<?php

  $payload = array(
    'grant_type' => 'password',
    'username' => API_KEY,
    'password' => API_SECRET_KEY
  );

  $url = '/oneapi/authentication/token';

  //  This function encapsulates the curl method
  list($err, $response) = doPost($url, $payload);

Body parameters (as JSON)

Parameter Mandatory Description Comment
grant_type Yes Type of request string, always set to ‘password’
username Yes Username (commonly the API key) string
password Yes Password (commonly the API Secret key) string

Response

A JSON like: { "access_token": "87eb6f50-d0e2-45d5-ab18-526b60bfc74c", "token_type": "bearer", "expires_in": 3600 }

Field Description Comment
access_token Token to use in endpoints to authenticte the request
token_type Always set to ‘bearer’
expires_in Seconds of validation of this token

Get Current Authenticated

Sometimes you need to retrieve some information of the entity being authenticated with your access_token. Some information retrieved by this method is needed for some other endpoints.

HTTP Request

GET /oneapi/v0/current

<?php
  $url = '/oneapi/v0/current';

  //  This function encapsulates the curl method
  list($err, $response) = doGet($url, ACCESS_TOKEN);

Response

A JSON like: { "data": { "enterprise_id": "20" } }

Field Description Comment
enterprise_id Id of the enterprise this authenticate request belongs to. int

Enterprises

Get Groups of Enterprise

An enterprise in Jobbers can be composed by groups. This endpoint retrieves the groups of the enterprise being authenticated.

HTTP Request

GET /oneapi/v0/groupsofenterprises

<?php

  $url = '/oneapi/v0/groupsofenterprises';
  list($err, $response) = doGet($url, ACCESS_TOKEN);

Response

A JSON like: { "data": [ { "group_id": 373, "name": "Sous conciergerie #1 Demonstration" }, { "group_id": 374, "name": "Sous conciergerie #2 Demonstration" } ] }

Field Description Comment
group_id Id of the group of enterprise int
name Name of the gorup of enterprise string

Get Stats

This endpoint gets the usage statistics of the enterprise being authenticated corresponding to a certain period (month and year).

HTTP Request

GET /oneapi/v0/stats?month=7&year=2018

<?php

  $url = sprintf('/oneapi/v0/stats?month=%s&year=%s', urlencode($month), urlencode($year));
  list($err, $response) = doGet($url, ACCESS_TOKEN);

URL Parameters

Parameter Mandatory Description Comment
month Yes Month between 1 and 12
year Yes Year in 4 digits

Response

A JSON like: { "data": [ { "group_id": null, "last_updated": "2018-09-03 18:33:43", "total_requests": 52, "delta_requests": 52, "total_passes": 0, "delta_passes": 0, "total_clients": 10, "delta_clients": 10, "percentage_female_clients": 0, "percentage_male_clients": 20, "percentage_unknown_clients": 80, "nologin_clients": { "total": 10, "emails": [ "client+1@clients.jobbers.com", "oriol.marti+3@gmail.com", "oriol.marti+5@gmail.com", "oriol.marti+6@gmail.com", "oriol.marti+7@gmail.com", "oriol.marti+8@gmail.com", "oriol.marti+9@gmail.com", "oriol.marti+10@gmail.com", "oriol.marti+11@gmail.com", "oriol.marti+14@gmail.com" ] }, "tags": [ { "tag_name": "sports", "percent": 0 }, { "tag_name": "enfants", "percent": 0 }, { "tag_name": "voyages", "percent": 0 }, { "tag_name": "services_domicile", "percent": 0 }, { "tag_name": "services_individus", "percent": 82.61 }, { "tag_name": "animaux", "percent": 0 }, { "tag_name": "auto_moto", "percent": 4.35 }, { "tag_name": "coaching", "percent": 0 }, { "tag_name": "livraison", "percent": 0 }, { "tag_name": "administratif", "percent": 0 }, { "tag_name": "demenagement", "percent": 0 }, { "tag_name": "anniversaire", "percent": 8.7 }, { "tag_name": "mariage_pacs", "percent": 0 }, { "tag_name": "evg", "percent": 0 }, { "tag_name": "romantique", "percent": 0 }, { "tag_name": "fetes", "percent": 0 }, { "tag_name": "reservation", "percent": 0 }, { "tag_name": "marketplace", "percent": 0 }, { "tag_name": "recherches", "percent": 4.35 }, { "tag_name": "medical", "percent": 0 }, { "tag_name": "bons_plans", "percent": 0 } ], "avergage_conversation_rating": 0, "total_orders": { "total": 0, "categories": [ { "category_id": "2", "category_name": "Accueil", "percent": 0.28 }, { "category_id": "21", "category_name": "Repassage-MyPressing", "percent": 3.43 } ] } }, { "group_id": 373, "last_updated": "2018-09-03 18:33:45", "total_requests": 0, "delta_requests": 0, "total_passes": 1, "delta_passes": 1, "total_clients": 0, "delta_clients": 0, "percentage_female_clients": 0, "percentage_male_clients": 20, "percentage_unknown_clients": 80, "nologin_clients": { "total": 0, "emails": [] }, "tags": [ { "tag_name": "sports", "percent": 0 }, { "tag_name": "enfants", "percent": 0 }, { "tag_name": "voyages", "percent": 0 }, { "tag_name": "services_domicile", "percent": 0 }, { "tag_name": "services_individus", "percent": 82.61 }, { "tag_name": "animaux", "percent": 0 }, { "tag_name": "auto_moto", "percent": 4.35 }, { "tag_name": "coaching", "percent": 0 }, { "tag_name": "livraison", "percent": 0 }, { "tag_name": "administratif", "percent": 0 }, { "tag_name": "demenagement", "percent": 0 }, { "tag_name": "anniversaire", "percent": 8.7 }, { "tag_name": "mariage_pacs", "percent": 0 }, { "tag_name": "evg", "percent": 0 }, { "tag_name": "romantique", "percent": 0 }, { "tag_name": "fetes", "percent": 0 }, { "tag_name": "reservation", "percent": 0 }, { "tag_name": "marketplace", "percent": 0 }, { "tag_name": "recherches", "percent": 4.35 }, { "tag_name": "medical", "percent": 0 }, { "tag_name": "bons_plans", "percent": 0 } ], "avergage_conversation_rating": 0, "total_orders": { "total": 0, "categories": [] } }, { "group_id": 374, "last_updated": "2018-09-03 18:33:46", "total_requests": 0, "delta_requests": 0, "total_passes": 0, "delta_passes": 0, "total_clients": 0, "delta_clients": 0, "percentage_female_clients": 0, "percentage_male_clients": 20, "percentage_unknown_clients": 80, "nologin_clients": { "total": 0, "emails": [] }, "tags": [ { "tag_name": "sports", "percent": 0 }, { "tag_name": "enfants", "percent": 0 }, { "tag_name": "voyages", "percent": 0 }, { "tag_name": "services_domicile", "percent": 0 }, { "tag_name": "services_individus", "percent": 82.61 }, { "tag_name": "animaux", "percent": 0 }, { "tag_name": "auto_moto", "percent": 4.35 }, { "tag_name": "coaching", "percent": 0 }, { "tag_name": "livraison", "percent": 0 }, { "tag_name": "administratif", "percent": 0 }, { "tag_name": "demenagement", "percent": 0 }, { "tag_name": "anniversaire", "percent": 8.7 }, { "tag_name": "mariage_pacs", "percent": 0 }, { "tag_name": "evg", "percent": 0 }, { "tag_name": "romantique", "percent": 0 }, { "tag_name": "fetes", "percent": 0 }, { "tag_name": "reservation", "percent": 0 }, { "tag_name": "marketplace", "percent": 0 }, { "tag_name": "recherches", "percent": 4.35 }, { "tag_name": "medical", "percent": 0 }, { "tag_name": "bons_plans", "percent": 0 } ], "avergage_conversation_rating": 0, "total_orders": { "total": 0, "categories": [] } }, ] }

The same structure is repeated for the enterprise and the groups of the enterprise (in case they exists).

Field Description Comment
group_id Id of the group of the enterprise (null when the main enterprise)
last_updated Datetime of the stats calculation Format Y-m-d H:i:s
total_requests Requests are the interactions between a Jobbers Agent and a Jobbers Client. This amount is the aggregated requests for this enterprise or group
delta_requests Requests done in this period
total_passes Passes are the “bypass” tokens used to register or keep registered in the Jobbers area. This amount is the aggregated used passes for this enterprise or group
delta_passes Passes used in this period
total_clients Clients registered to this enterprise or group
delta_clients Clients registered in this period
percentage_female_clients Clients registered as female, as percent Double
percentage_male_clients Clients registered as male, as percent Double
percentage_unknown_clients Clients registered with unknown sex, as percent Double
nologin_clients.total Clients that has not yet perform a login in Jobbers
nologin_clients.emails List of the mails that haven’t yet perform a login in Jobbers
tags.tag_name Name of the label assigned to a conversation. A conversation is a thread of interactions between a Jobbers Agent and a Jobbers Client.
tags.percent Percent of the usage of this tag in conversations Double
avergage_conversation_rating Clients can rate a conversation. This is the average of these ratings Double
total_orders.total Amount of purchases performed by Jobbers clients belonging to this enterprise or group
total_orders.categories.category_id Id of the category owning products being purchased
total_orders.categories.category_name Name of the category owning products being purchased
total_orders.categories.percent Percent of the productes belonging to this category being purchased

Stock of Passes

Get Stock of Passes of Enterprise

Gets the stock of passes available belonging to the authenticated enterprise.

HTTP Request

GET /oneapi/v0/stockofpasses

<?php

  $url = '/oneapi/v0/stockofpasses';
  list($err, $response) = doGet($url, ACCESS_TOKEN);

Response

A JSON like: { "data": [ { "stock_id": 53, "description": "single pass 2", "duration": 1, "duration_type": "YEAR", "expiration_date": "2018-07-30 23:59:59", "total_units": 3, "total_available": 3, "total_used": 0, "price": 0, "net_price": 0, "vat": 0 }, { "stock_id": 52, "description": "single pass", "duration": 1, "duration_type": "YEAR", "expiration_date": "2018-12-27 23:59:59", "total_units": 10, "total_available": 10, "total_used": 0, "price": 10.1, "net_price": 10, "vat": 10 } ] }

Field Description Comment
stock_id Id of the stock int
description Name of the stock string
duration Integer int
duration_type DAY/MONTH/YEAR, in combination with the duration field string
expiration_date datetime until the stock will be available Format Y-m-d H:i:s
total_units total units in the stock int
total_available total available in the stock int
total_used total already used in the stock int
price total price (including vat and base price) float
net_price total net price (without vat) float
vat percent of vat int

Assign Pass to Client

This endpoint assigns a pass available from a stock of passes to the given client

HTTP Request

POST /oneapi/v0/stockofpasses/assign

<?php

  $payload = array(
    'email' => 'client@clients.jobbers.com',
    'stock_id' => 52,
    'payment_reference' => 'payment_reference_01'
  );

  $url = '/oneapi/v0/stockofpasses/assign';

  //  This function encapsulates the curl method
  list($err, $response) = doPost($url, $payload);

Body parameters (as JSON)

Parameter Mandatory Description Comment
email Yes Client email string
stock_id Yes Id of the stock to get the pass from int
payment_reference Yes External Id to identiy this transaction, provided by your own mechanism. Must be unique string

Response

{ "data": { "end_subscription_date": "2021-09-09 23:59:59" } }

Field Description Comment
end_subscription_date The new end of subscription date calculated using this pass Format Y-m-d H:i:s

Invoice of a Pass Assignment

This endpoint generates a URL with the invoice corresponding to a pass assignment.

HTTP Request

POST /oneapi/v0/stockofpasses/invoice

NOT IMPLEMENTED YET

Body parameters (as JSON)

Parameter Mandatory Description Comment
payment_reference Yes External reference to identify the transaction, provided by you. Must be unique string
first_name Yes First name to appear in the invoice string
last_name Yes Last name to appear in the invoice string
address Yes Address to appear in the invoice string
zip_code Yes Zip code to appear in the invoice string
city  Yes City to appear in the invoice string
country Yes Country to appear in the invoice string

Response

NOT IMPLEMENTED YET

Clients

Checking Email Exists

Cheks wether the given email exists or not as a client registered in Jobbers.

HTTP Request

GET /oneapi/v0/clients/{clientEmail}/exists

<?php

  $email = urlencode("client@clients.jobbers.com");

  $url = sprintf('/oneapi/v0/clients/%s/exists', $client));
  list($err, $response) = doGet($url, ACCESS_TOKEN);

URL parameters

Parameter Mandatory Description
clientEmail Yes Email to check

Remember that URL parameters should always be urlencoded.

Response

A JSON like: { "data": { "exists": true, "movable": false, "attached_to_another_enterprise": false, "subscription_valid": true, "client_active": true } }

Field Description Comment
exists true if email is registered in Jobbers boolean
movable true if email can be moved to your enterprise boolean
attached_to_another_enterprise true if email belongs to an enterprise other than yours boolean
subscription_valid true if email has a valid subscription boolean
client_active true if email belongs to an active client boolean

Getting a Client

Gets all data of the client given his email. You can perform this operation passing the clientId or the clientEmail.

HTTP Request

GET /oneapi/v0/clients/{clientIdOrClientEmail}

<?php

  $email = urlencode("client@clients.jobbers.com");

  $url = sprintf('/oneapi/v0/clients/%s', $client));
  list($err, $response) = doGet($url, ACCESS_TOKEN);

URL parameters

Parameter Mandatory Description
clientId Yes/No Id of the client to update
clientEmail No/Yes Email of the client to update

Remember that URL parameters should always be urlencoded.

Response

A json like: { "data": { "client_id": 40331, "email": "client@clients.jobbers.com", "first_name": "prenom", "last_name": "nom", "phone_prefix": "+33", "phone": "987654321", "gender": "FEMALE", "address": "32 rue des volontaires", "zip_code": "75015", "city": "Paris", "country": "FR", "cgu": true, "optin": false, "registering_date": "2018-07-12 10:09:24", "last_login_date": null, "end_subscription_date": "2018-09-09 14:37:03", "active": true, "group_id": 374 } }

Field Description Comment
client_id Inner id of the client int
email Email string
first_name Name string
last_name Surname string
phone_prefix International phone number prefix string
phone Telephone number string
gender MALE or FEMALE string
address Address string
zip_code Postal code string
city City string
country ISO (two letter) country string
cgu General conditions acceptance boolean
optin Send outbound emailings boolean
registering_date Date of register Format Y-m-d H:i:s
last_login_date Date of last login Format Y-m-d H:i:s
end_subscription_date Date of end of subscription Format Y-m-d H:i:s
active Status boolean
group_id group inside the enterprise the client belongs to integer

Creating Client

Creates a new client in Jobbers that belongs to the enterprise being authenticated.

HTTP Request

POST /oneapi/v0/clients

<?php

  $payload = array(
    'email' => 'client@clients.jobbers.com',
    'group_id' => 372,
    'first_name' => 'prenom',
    'last_name' => 'nom',
    'phone_prefix' => '+33',
    'phone' => '987654321',
    'address' => '32 rue des voluntaires',
    'zip_code' => '75015',
    'city' => 'Paris',
    'country' => 'FR',
    'optin' => true,
    'cgu' => true,
    'gender' => 'FEMALE'
  );

  //  prepare the url
  $url = '/oneapi/v0/clients';
  list($err, $response) = doPost($url, $payload, ACCESS_TOKEN);

Body parameters (as JSON)

Parameter Mandatory Description Comment
email Yes Email string
group_id No Enterprise group belonging to string
first_name Yes Name string
last_name Yes Surname string
phone_prefix Yes International phone prefix string
phone Yes Telephone number string
address Yes Address string
zip_code Yes Postal code string
city Yes City string
country Yes ISO 3166-1 alpha-2 codes string
cgu Yes General conditions acceptance must be true
optin Yes Send outbound emailings true/false
gender No MALE/FEMALE constants string

Response

A JSON like:

{ "data": { "client_id": 40331, "email": "client@clients.jobbers.com", "first_name": "prenom", "last_name": "nom", "phone_prefix": "+33", "phone": "987654321", "gender": "FEMALE", "address": "32 rue des volontaires", "zip_code": "75015", "city": "Paris", "country": "FR", "cgu": true, "optin": false, "registering_date": "2018-07-12 10:09:24", "last_login_date": null, "end_subscription_date": "2018-09-09 14:37:03", "active": true, "group_id": 374, "password": "G*zyn9L>" } }

It’s the same output as the operation Getting a Client but with an added field:

Field Description Comment
password Automatic random password You can use it or not depending on what interactions are done with this client

Updating a Client

Updates an existing client in Jobbers. You can perform this operation passing the clientId or the clientEmail.

HTTP Request

POST /oneapi/v0/clients/{clientIdOrClientEmail}

<?php

  $payload = array(
    "email" => "client@clients.jobbers.com",
    "group_id" => 373,
    "first_name" => "prenom2",
    "last_name" => "nom2",
    "phone_prefix" => "+33",
    "phone" => "176440400",
    "street" => "32 rue des volontaires",
    "zip_code" => "75015",
    "gender" => "MALE",
    "city" => "Paris",
    "country" => "FR",
    "optin" => true
  );

  //  prepare the url
  $email = urlencode("client@clients.jobbers.com");
  $url = sprintf('/oneapi/v0/clients/%s', $client));

  list($err, $response) = doPost($url, $payload, ACCESS_TOKEN);

URL parameters

Parameter Mandatory Description
clientId Yes/No Id of the client to update
clientEmail No/Yes Email of the client to update

Remember that URL parameters should always be urlencoded.

Body parameters (as JSON)

Same input as creating a client except the CGU field which is no needed anymore

Response

A JSON like the on in Getting a Client.

Deleting Client

Deletes an existing client in Jobbers

HTTP Request

DELETE /oneapi/v0/clients/{clientIdOrClientEmail}

<?php

  //  prepare the url
  $email = urlencode("client@clients.jobbers.com");
  $url = sprintf('/oneapi/v0/clients/%s', $client));

  list($err, $response) = doDelete($url, ACCESS_TOKEN);

URL parameters

Parameter Mandatory Description
clientId Yes/No Id of the client to update
clientEmail No/Yes Email of the client to update

Remember that URL parameters should always be urlencoded.

Response

A JSON like: { "data": { "leaving_date":"2018-07-12 11:18:44" } }

Autologin Client

Enables a client to log in Jobbers. This a two step process. You have to:

  1. Ask for a token for this client to login Jobbers. This token is valid to be used only 1 time and in one hour max.
  2. Redirect the client to a link using this token.

If the token is not valid the user will be redirected to the jobbers landing page. If the log in is correct, user will be redirected to the jobbers’ client landing page.

1. Get a Token

HTTP Request

GET /oneapi/v0/clients/{clientIdOrClientEmail}/login

<?php

  //  prepare the url
  $email = urlencode("client@clients.jobbers.com");
  $url = sprintf('/oneapi/v0/clients/%s/login', $client));

  list($err, $response) = doGet($url, ACCESS_TOKEN);

Response

A JSON like: { "data": { "url": "https://www.jobbers.com/oneappweb/?token=3f2dcc2fce47f959f3519ec43648cc31df67e9a0de40f95c1ccbba24b519aec0" } }

2. Redirect client

You have to redirect your client to the url you have received from the point above:

Redirect to URL

<?php

  //  get the url following the above instructions
  $url = URL;

  header('Location: ' . $url);
  exit();

PHP