menu
FR | EN

PHP documentation for Octoplus API

Before starting

require_once("api_library.php");

Authentication

Your connection settings can be found in the "API Settings" page, available in the left menu. The following information is given for information only.

$login = "12345";
$password = "secret";

Stock request

Products called as a multidimensional array

$product = array(
array(
"ean" => "3701348612517",
"franco" => 1,
"type" => 1
),
array(
"ean" => "5707562314648",
"franco" => 1,
"type" => 1
)
);

Settings for each associative array
ean Required EAN of the searched tyre
franco Required 1 for FRANCO2, 2 for FRANCO6, 3 for EXW
type Required 1 for Best price, 2 for Best delay
quantity Optional Number of wanted tyres
price Optional Wished price (excluding tax)
API call

$stock = exchange_request($login,$password,$product);

Answer

The API returns a multidimensional array whose keys correspond to the EANs sent as parameters or textual information in case of error.

// Errors management

if (!is_array($stock))
{
       echo($stock);
       exit;
}

// API answer

foreach ($stock as $ean => $detail)
{
       echo("EAN : ".$ean.",
       Quantity : ".$detail["quantity"].",
       Price : ".$detail["price"].",
       Franco : ".$detail["franco"].",
       Type : ".$detail["type"].",
       Délai de livraison : ".$detail["delai"]);
}

Informations sent by API
ean EAN of the searched tyre
franco 1 for FRANCO2, 2 for FRANCO6, 3 for EXW
type 1 for Best price, 2 for Best delay
quantity Number of tyres in stock
price Tyre price (excluding tax)
delai Delivery delay (days)
Errors codes
0 Missing login
1 Missing token
2 Unknown user
3 Missing product
4 Bad format of product
5 Missing EAN
6 Missing franco
7 Missing type
8 Unknown EAN
9 Unknown franco
10 Bad franco
11 Not enough stock
12 Bad price
13 Bad provider
S0 Bad connection to API provider
S1 No response from provider
S2 Unknown product for provider
S3 Not enough stock for provider
S4 Bad price for provider

Order creation

The creation of an order deals with 3 associative arrays :

  • Customer data,
  • Products list (multidimensional array),
  • Additional data.

// Customer

$customer = array(
"contact_code" => "CRM123",
"contact_company" => "Octoplus",
"contact_juridicform" => "5",
"contact_siret" => "50045262300010",
"contact_notva" => "FR76300400500",
"contact_lastname" => "Dupont",
"contact_firstname" => "Pierre",
"contact_phone" => "0612345678",
"contact_mail" => "pierre.dupont@gmail.com",
"contact_street1" => "120 avenue de la République",
"contact_street2" => "ZA du Commerce",
"contact_zipcode" => "75015",
"contact_cityname" => "Paris",
"contact_country" => "FR",
"delivery_company" => "Octoplus",
"delivery_juridicform" => "5",
"delivery_siret" => "50045262300010",
"delivery_lastname" => "Dupont",
"delivery_firstname" => "Pierre",
"delivery_phone" => "0612345678",
"delivery_mail" => "pierre.dupont@gmail.com",
"delivery_street1" => "120 avenue de la République",
"delivery_zipcode" => "75015",
"delivery_cityname" => "Paris",
"delivery_country" => "FR",
"billing_company" => "Octoplus",
"billing_juridicform" => "5",
"billing_siret" => "50045262300010",
"billing_lastname" => "Dupont",
"billing_firstname" => "Pierre",
"billing_phone" => "0612345678",
"billing_mail" => "pierre.dupont@gmail.com",
"billing_street1" => "120 avenue de la République",
"billing_zipcode" => "75015",
"billing_cityname" => "Paris",
"billing_country" => "FR"
);

// Products

$cart = array(
array(
"ean" => "5707562325330",
"quantity" => 8,
"price" => 15.59,
"franco" => 1,
"type" => 1
),
array(
"ean" => "3701348612517",
"quantity" => 4,
"price" => 20.01,
"franco" => 1,
"type" => 1
)
);

// Additional data

$other = array(
"reference" => "TEST123",
"paymentmode" => "3",
"bankname" => "CIC",
"bankiban" => "FR765242135598",
"bankswift" => "CICBIC",
"deliverydate" => "2022-02-18"
);

Settings of the customer array

Main contact

contact_code Optional Customer code in Octoplus ERP
contact_company Optional Company
contact_juridicform Optional ID of the legal form (see below)
contact_siret Optional SIRET number
contact_notva Optional VAT number
contact_lastname Required Last name
contact_firstname Required First name
contact_phone Required Phone
contact_mail Required Mail
contact_street1 Required Address
contact_street2 Optional Additional address
contact_zipcode Required ZIP code
contact_cityname Required City
contact_country Required Country code (ISO 3106)

Delivery

delivery_company Optional Company
delivery_juridicform Optional ID of the legal form (see below)
delivery_siret Optional SIRET number
delivery_notva Required VAT number
delivery_lastname Required Last name
delivery_firstname Required First name
delivery_phone Required Phone
delivery_mail Required Mail
delivery_street1 Required Address
delivery_street2 Optional Additional address
delivery_zipcode Required ZIP code
delivery_cityname Required City
delivery_country Required Country code (ISO 3106)

Billing

billing_company Optional Company
billing_juridicform Optional ID of the legal form (see below)
billing_siret Optional SIRET number
billing_notva Required VAT number
billing_lastname Required Last name
billing_firstname Required First name
billing_phone Required Phone
billing_mail Required Mail
billing_street1 Required Address
billing_street2 Optional Additional address
billing_zipcode Required ZIP code
billing_cityname Required City
billing_country Required Country code (ISO 3106)
Settings of each cart associative array
ean Required EAN of searched tyre
franco Required 1 for FRANCO2, 2 for FRANCO6, 3 for EXW
type Required 1 for Best price, 2 for Best delay
quantity Required Number of wanted tyres
price Required Price (excluding tax)
Settings of the additional data array
reference Optional Customer order number
paymentmode Optional ID of payment mode (see below)
bankname Optional Customer bank name
bankiban Optional Customer IBAN
bankswift Optional Customer BIC
deliverydate Optional Wished delivery date, format AAAA-MM-JJ
API call

$order = order_request($login,$password,$customer,$cart,$other);

Answer

The API returns an order number (3 uppercase letters and 8 digits) in an associative array whose key is "reference" or textual information in case of error.

// Errors management

if (!is_array($order))
{
       echo($order);
       exit;
}

// API answer

echo("Reference : ".$order["reference"]);

Information sent by API
reference Octoplus order number
Errors codes
0 Missing login
1 Missing token
2 Unknown user
3 Missing customer
4 Missing products
5 Missing additional data
6 Bad format for customer
7 Unknown contact type
8 Missing last name
9 Missing first name
10 Missing address
11 Missing zip code
12 Missing city
13 Missing country
14 Unknown legal form
15 Missing VAT number
16 Unknown country
17 Bad format for products
18 Missing EAN
19 Missing quantity
20 Missing price
21  Missing franco
22 Missing type
23 Unknown EAN
24 Unknown franco
25 Bad franco
26 Bad price
27 Bad stock
28 Bad format for additional data
29 Unknown payment mode
30 Bad format for delivery date
31 Empty cart
C0 Bad connection to API provider
C1 Unknown product for provider
C2 Order refused by provider

Order status

Orders called as a multidimensional array

$order = array(
array(
"reference" => "ABC12345678"
),
array(
"reference" => "DEF87654321"
)
);

Settings for each associative array
reference Required Octoplus order number (3 letters and 8 numbers) or client internal reference
API call

$status = status_request($login,$password,$order);

Answer

The API returns a multidimensional array whose keys correspond to the references sent as parameters or textual information in case of error.

// Errors management

if (!is_array($status))
{
       echo($status);
       exit;
}

// API response

foreach ($status as $reference => $infos)
{
       foreach ($infos as $detail)
       {
              echo("<p>Octoplus reference :".$detail["reference"].",
              Customer reference : ".$detail["internal"].",
              Status : ".$detail["status"]."</p>"
              );
       }
}

Informations sent by API
reference Octoplus reference
internal Customer reference
status Order status (1 : Waiting for validation, 2 : Validated, 3 : Shipped, 5 : Cancelled)
Errors codes
0 Missing login
1 Missing token
2 Unknown user
3 Missing order
4 Bad format of order
5 Missing reference
6 Unknown reference

Tracking

Orders called as a multidimensional array

$order = array(
array(
"reference" => "ABC12345678"
),
array(
"reference" => "DEF87654321"
)
);

Settings for each associative array
reference Required Octoplus order number (3 letters and 8 numbers) or client internal reference
API call

$tracking = tracking_request($login,$password,$order);

Answer

The API returns a multidimensional array whose keys correspond to the references sent as parameters or textual information in case of error.

// Errors management

if (!is_array($tracking))
{
       echo($tracking);
       exit;
}

// API response

foreach ($tracking as $reference => $infos)
{
       foreach ($infos as $detail)
       {
              echo("<p>Octoplus reference :".$detail["reference"].",
              Customer reference : ".$detail["internal"].",
              ID : ".$detail["id"].",
              Link : ".$detail["link"].",
              Carrier : ".$detail["carrier"]."</p>"
              );
       }
}

Informations sent by API

In case of missing tracking, the values of tracking number, tracking link and carrier are empty.

reference Octoplus reference
internal Customer reference
id Tracking number
link Tracking link
career Carrier
Errors codes
0 Missing login
1 Missing token
2 Unknown user
3 Missing order
4 Bad format of order
5 Missing reference
6 Unknown reference
7 No tracking for this reference

Billing

Orders called as a multidimensional array

$order = array(
array(
"reference" => "ABC12345678"
),
array(
"reference" => "DEF87654321"
)
);

Settings for each associative array
reference Required Octoplus order number (3 letters and 8 numbers) or client internal reference
API call

$billing = billing_request($login,$password,$order);

Answer

The API returns a multidimensional array whose keys correspond to the references sent as parameters or textual information in case of error.

// Gestion des erreurs

if (!is_array($billing))
{
       echo($billing);
       exit;
}

// API response

foreach ($billing as $reference => $infos)
{
       foreach ($infos as $detail)
       {
              echo("<p>Octoplus reference Octoplus :".$detail["reference"].",
              Customer reference : ".$detail["internal"].",
              Invoice reference : ".$detail["number"].",
              Link of the invoice : ".$detail["link"]."</p>
              );
       }
}

Informations sent by API

In case of missing billing, the values of invoice reference and link of the invoice are empty.

reference Octoplus reference
internal Customer reference
number Invoice reference
link Link of the invoice
Errors codes
0 Missing login
1 Missing token
2 Unknown user
3 Missing order
4 Bad format of order
5 Missing reference
6 Unknown reference
7 No tracking for this reference

Annexes

ID of legal forms
1 Association
2 EURL
3 SARL
4 SAS
5 SASU
6 SCI
7 SNC
8 Société civile
9 Entreprise individuelle
10 Auto-entreprise
11 EIRL
12 SCA
13 SCS
14 SA à conseil d'administration
15 Collectif
16 Collectivité territoriale
17 SELARL
18 SELAS
19 SELCA
20 Affaire personnelle commerçant
ID of payment modes
1 Online payment
2 Bank check
3 Bank transfer
4 Bill of exchange
5 Debit
expand_less