Suppliers

Get Suppliers

curl "https://example.ziik.io/api/suppliers"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
{
  "hits": [
    {
        "id": 822,
        "content_type": "supplier",
        "permissions": {
            "edit": true,
            "delete": true
        },
        "name": "Plus Company",
        "description": null,
        "category": [{
            "id": 162,
            "name": "Office supply",
            "url": "api/suppliers/categories/162"
        }],
        "type": {
            "id": 1,
            "type": "My Unit"
        },
        "unit": {
            "id": 102,
            "name": "Ziik",
            "url": "api/units/102"
        },
        "address": {
            "registration_number": "123456",
            "vat_number": "123456",
            "street": "Nørre Voldgade 18 ",
            "postal_code": "1358",
            "city": "København K",
            "phone": "+45 72161818",
            "email": "sales@pluscompanyexample.com",
            "webpage": {
                "url": "http://www.pluscompanyexample.com",
                "title": null,
                "attributes": []
            },
            "webshop": {
                "url": "http://www.pluscompanyexample.com",
                "title": null,
                "attributes": []
            }
        },
        "payment": {
            "account_number": "1234567",
            "bank": "Example Bank",
            "bic": "lsadf32424",
            "branch": "1234",
            "eban": "blafd234234",
            "delivery": "within 8 days",
            "payment": "within 30 days"
        },
        "contacts": [{
            "name": "Contact #1",
            "title": "Seller",
            "email": "seller@pluscompanyexample.com",
            "phone": "45454545",
            "mobile": "46464646",
            "skype": "pluscompanyexample.skype"
        }, {
            "name": "Contact #2",
            "title": "Salesman",
            "email": "seller2@pluscompanyexample.com",
            "phone": "42424242",
            "mobile": "43434343",
            "skype": "pluscompanyexample2.skype"
        }],
        "agreement": "Terms of the supplier agreement",
        "files": [{
            "id": 941,
            "name": "terms.pdf",
            "mime": "application/pdf",
            "size": 118518,
            "type": "document",
            "source": "https://example.ziik.io/api/file/supplier/terms.pdf"
        }],
        "url": "api/suppliers/822"
    }, {
        "id": 821,
        "content_type": "supplier",
        "permissions": {
            "edit": true,
            "delete": true
        },
        "name": "anothersite.com",
        "description": null,
        "category": [{
            "id": 151,
            "name": "IT",
            "url": "api/suppliers/categories/151"
        }],
        "type": {
            "id": 2,
            "type": "Chain"
        },
        "unit": {
            "id": 102,
            "name": "Ziik",
            "url": "api/units/102"
        },
        "address": {
            "registration_number": "12345678",
            "vat_number": "DK12345678",
            "street": "Example street 34",
            "postal_code": "1111",
            "city": "Exampleville",
            "phone": "+4412345678",
            "email": "sales@anothersite.com",
            "webpage": {
                "url": "http://www.anothersite.com",
                "title": null,
                "attributes": []
            },
            "webshop": null
        },
        "payment": {
            "account_number": "111111111",
            "bank": "Test bank",
            "bic": "TESTDKK",
            "branch": "1234",
            "eban": "DK1234567890123",
            "delivery": null,
            "payment": null
        },
        "contacts": [{
            "name": "Peter",
            "title": null,
            "email": null,
            "phone": null,
            "mobile": null,
            "skype": null
        }],
        "agreement": null,
        "files": [],
        "url": "api/suppliers/821"
    }
  ],
  "meta": {
      "pagination": {
          "total": 315,
          "count": 50,
          "per_page": 50,
          "current_page": 2,
          "total_pages": 7,
          "links": []
      }
  }
}

This endpoint retrieves a list of suppliers.

HTTP Request

GET https://example.ziik.io/api/suppliers

Query Parameters

ParameterTypeDefaultDescription
typeIntegerNULL1 = Unit, 2 = Chain
categoryIntegerNULLIf set, only show suppliers from this category
pageInteger1Page number for pagination.
limitInteger50Number of records to return per page.

Get Single Supplier

curl "https://example.ziik.io/api/suppliers/822"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"

The above command returns JSON structured like this:

  {
          "id": 822,
          "content_type": "supplier",
          "permissions": {
              "edit": true,
              "delete": true
          },
          "name": "Plus Company",
          "description": null,
          "category": [{
              "id": 162,
              "name": "Office supply",
              "url": "api/suppliers/categories/162"
          }],
          "type": {
              "id": 1,
              "type": "My Unit"
          },
          "unit": {
              "id": 102,
              "name": "Ziik",
              "url": "api/units/102"
          },
          "address": {
              "registration_number": "123456",
              "vat_number": "123456",
              "street": "Nørre Voldgade 18 ",
              "postal_code": "1358",
              "city": "København K",
              "phone": "+45 72161818",
              "email": "sales@pluscompanyexample.com",
              "webpage": {
                  "url": "http://www.pluscompanyexample.com",
                  "title": null,
                  "attributes": []
              },
              "webshop": {
                  "url": "http://www.pluscompanyexample.com",
                  "title": null,
                  "attributes": []
              }
          },
          "payment": {
              "account_number": "1234567",
              "bank": "Example Bank",
              "bic": "lsadf32424",
              "branch": "1234",
              "eban": "blafd234234",
              "delivery": "within 8 days",
              "payment": "within 30 days"
          },
          "contacts": [{
              "name": "Contact #1",
              "title": "Seller",
              "email": "seller@pluscompanyexample.com",
              "phone": "45454545",
              "mobile": "46464646",
              "skype": "pluscompanyexample.skype"
          }, {
              "name": "Contact #2",
              "title": "Salesman",
              "email": "seller2@pluscompanyexample.com",
              "phone": "42424242",
              "mobile": "43434343",
              "skype": "pluscompanyexample2.skype"
          }],
          "agreement": "Terms of the supplier agreement",
          "files": [{
              "id": 941,
              "name": "terms.pdf",
              "mime": "application/pdf",
              "size": 118518,
              "type": "document",
              "source": "https://example.ziik.io/api/file/supplier/terms.pdf"
          }],
          "url": "api/suppliers/822"
      }

This endpoint returns a single supplier

HTTP Request

GET https://example.ziik.io/api/suppliers/ID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the supplier

Permissions Required

  • Supplier is chain supplier
  • OR supplier's unit is user's unit

Create Supplier

curl -i -X POST "https://example.ziik.io/api/suppliers"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 201 Created with a location header for where to find the newly created supplier

HTTP/1.0 201 Created
Location: https://example.ziik.io/api/suppliers/1234
{
    "message": "Supplier created"
}

This endpoint creates a new supplier.

HTTP Request

POST https://example.ziik.io/api/suppliers

Request Parameters

ParameterTypeRequiredDescription
nameStringYesSupplier name.
descriptionStringNoSupplier description.
categoriesArrayNoIDs of the supplier categories
unitIntegerNoUnit to connect this supplier to, if applicable
typeIntegerYes1 = Unit, 2 = Chain
addressArrayNoAddress data for the primary company address with the following values
- phoneStringNoMain phone number (freetext) of supplier
- emailStringNoMain contact email for supplier
- streetStringNoStreet address
- postal_codeStringNoPostal code
- cityStringNoCity name
- webpageStringNoURL to supplier's website
- webshopStringNoURL to supplier's webshop
- vat_numberStringNoVAT number for the supplier
- registration_numberStringNoCompany registration number
paymentArrayNoPayment information with the following values
- account_numberStringNoBank account number
- bankStringNoBank name
- bicStringNoBank BIC identifier
- branchStringNoBank branch number
- ebanStringNoBank EBAN identifier
- deliveryStringNoDelivery terms
- paymentStringNoPayment terms
agreementStringNoGeneral text describing the agreement with the supplier
filesArrayNoFile data for files to accompany the event. If provided, must be an array of arrays with the following values
- typeStringYesType of file - can be either 'upload', 'youtube' or 'vimeo'.
- nameStringYesFile name.
- dataStringYesIf type is 'upload' this must be the base64 encoded content of the file. Else it must be the Youtube/Vimeo embed URL.
contactsArrayNoArray of contact persons with the supplier, each with the following values
- nameStringNoContact name
- titleStringNoContact work title
- emailStringNoContact email
- mobileStringNoContact mobile phone number
- phoneStringNoContact phone number
- skypeStringNoContact Skype name

Permissions Required

  • Write permission to Suppliers of the type

Edit Supplier

curl -i -X PATCH "https://example.ziik.io/api/suppliers/123"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content on successful update.

HTTP/1.0 204 No Content

This endpoint updates an existing supplier.

HTTP Request

PATCH https://example.ziik.io/api/suppliers/ID

Request Parameters

ParameterTypeRequiredDescription
nameStringNoSupplier name.
descriptionStringNoSupplier description.
categoriesArrayNoIDs of the supplier categories
unitIntegerNoUnit to connect this supplier to, if applicable
typeIntegerNo1 = Unit, 2 = Chain
addressArrayNoAddress data for the primary company address with the following values
- phoneStringNoMain phone number (freetext) of supplier
- emailStringNoMain contact email for supplier
- streetStringNoStreet address
- postal_codeStringNoPostal code
- cityStringNoCity name
- webpageStringNoURL to supplier's website
- webshopStringNoURL to supplier's webshop
- vat_numberStringNoVAT number for the supplier
- registration_numberStringNoCompany registration number
paymentArrayNoPayment information with the following values
- account_numberStringNoBank account number
- bankStringNoBank name
- bicStringNoBank BIC identifier
- branchStringNoBank branch number
- ebanStringNoBank EBAN identifier
- deliveryStringNoDelivery terms
- paymentStringNoPayment terms
agreementStringNoGeneral text describing the agreement with the supplier
filesArrayNoFile data for files to accompany the supplier. If provided, must be an array of arrays with the following values
- typeStringYesType of file - can be either 'upload', 'youtube' or 'vimeo'.
- nameStringYesFile name.
- dataStringYesIf type is 'upload' this must be the base64 encoded content of the file. Else it must be the Youtube/Vimeo embed URL.
contactsArrayNoArray of contact persons with the supplier, each with the following values
- nameStringNoContact name
- titleStringNoContact work title
- emailStringNoContact email
- mobileStringNoContact mobile phone number
- phoneStringNoContact phone number
- skypeStringNoContact Skype name

Permissions Required

  • Administer suppliers permission for the supplier type

Delete Supplier

curl -i -X DELETE "https://example.ziik.io/api/suppliers/123"
  -H "Authorization: Bearer aaaaaa.bbbbbbb.ccccccc"

The above command returns a 204 No Content header on success:

HTTP/1.0 204 No Content

This endpoint deletes a supplier.

HTTP Request

DELETE https://example.ziik.io/api/suppliers/ID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the supplier to delete

Permissions Required

  • Administer suppliers permission for the supplier type

Add Files To Supplier

curl -i -X POST "https://example.ziik.io/api/suppliers/files"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content on success

HTTP/1.0 204 No Content

This endpoint adds files to an existing supplier.

HTTP Request

POST https://example.ziik.io/api/suppliers/files

Request Parameters

ParameterTypeDescription
idIntegerThe ID of the supplier to add files to
filesArrayNo
- typeStringYes
- nameStringYes
- dataStringYes

Permissions Required

  • Supplier edit access

Delete File From Supplier

curl -i -X DELETE "https://example.ziik.io/api/suppliers/124/files/12345"
  -H "Authorization: Bearer aaaaaa.bbbbbbb.ccccccc"

The above command returns a 204 No Content header on success:

HTTP/1.0 204 No Content

This endpoint deletes a file from a supplier.

HTTP Request

DELETE https://example.ziik.io/api/suppliers/<SupplierID>/files/<FileID>

URL Parameters

ParameterTypeDescription
SupplierIDIntegerThe ID of the supplier
FileIDIntegerThe ID of the file to delete

Permissions Required

  • Supplier edit access