Contents
On this page

Create Supplier - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/suppliers

Add a supplier.

Needs a user with the plugixa_pos_purchase capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Unlike the other capabilities, Pro gives this one to administrators and to the WooCommerce Shop manager role.

Request

POST https://your-site.example/wp-json/plugixa-pos/v1/suppliers

Request body

Content type: application/json

Field Type Required Description
name string Yes 1 to 190 characters.
contact string No Contact person.
email string No Email.
phone string No Phone.
tax_id string No Tax id.
notes string No Up to 2000 characters.
lead_time_days integer No 0 to 365.
address object No address_1, address_2, postcode, city, country.
status string No active (default) or archived.
{
  "name": "Atelier Grès & Terre",
  "email": "contact@gres-terre.test",
  "lead_time_days": 10
}

Responses

201 Created.

{
  "success": true,
  "data": {
    "id": 2,
    "name": "Atelier Grès & Terre",
    "contact": "",
    "email": "contact@gres-terre.test",
    "phone": "",
    "address": {
      "address_1": "",
      "address_2": "",
      "postcode": "",
      "city": "",
      "country": ""
    },
    "tax_id": "",
    "lead_time_days": 10,
    "notes": "",
    "status": "active"
  }
}

Errors

Status Code When
400 rest_missing_callback_param name is missing.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/suppliers" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Atelier Grès & Terre","email":"contact@gres-terre.test","lead_time_days":10}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/suppliers');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'name'           => 'Atelier Grès & Terre',
        'email'          => 'contact@gres-terre.test',
        'lead_time_days' => 10,
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/suppliers', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Atelier Grès & Terre', email: 'contact@gres-terre.test', lead_time_days: 10 }),
});
const { data } = await response.json();

Quick Links

Share