NAV
php

Getting Started

Introduction

Coredna provides a RESTful API to implement the Coredna platform into your business or application. This reference provides information about the Coredna API, the resources and how to make requests.

Authentication

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/resource');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Coredna supports Bearer and Basic authentication methods via Authorization HTTP request header. Coredna expects an API key to be included in all API requests to the server using a request header that looks like this:

Authorization: Bearer youruniqueapikey

In some cases you may want to access Coredna without a request header, such as testing or viewing resources in your browser. If an attempt is made to access Coredna without the correct request header you will receive a basic authentication prompt, you can authenticate your request by using your API key as a username with no password.

Responses

HTTP/1.1 200 OK
{
    "data" : [
        {
            "id": 3,
            "name": "Buzz Cola",
            "cost": "12.99",
            "availability": {
                "quantity": "100",
                "status": "in_stock"
            }
        }
    ],
    "transaction_id": 17,
    "time": "32ms"
}
<?xml version="1.0"?>
<root>
    <data>
        <id>3</id>
        <name>Buzz Cola</name>
        <cost>12.99</cost>
        <availability>
            <quantity>100</quantity>
            <status>in_stock</status>
        </availability>
    </data>
    <transaction_id>17</transaction_id>
    <time>32ms</time>
</root>
HTTP/1.1 401 Unauthorized
{
    "error" : "No API key was specified, an API key must be passed in the Authorization header or as a username if using basic authentication",
    "transaction_id": 18,
    "time": "21ms"
}
<?xml version="1.0"?>
<root>
    <error>No API key was specified, an API key must be passed in the Authorization header or as a username if using basic authentication</error>
    <transaction_id>18</transaction_id>
    <time>21ms</time>
</root>

Regardless of the whether the request is successful or not Coredna will always return a JSON or XML object which will contain two pieces of meta data: a unique transaction_id for this request and the time taken to process the request in milliseconds.

Format

The format for responses can be controlled via the accept header. Coredna will change the response format if one of the following accept headers are used:

If no accept header is specified, application/json will be used by default.

Success

A successful response will be accompanied by a success status code. The object returned will also contain the key data which will contain data depending on the request:

Request Type Description
Add Object The newly created object
Get All Array[Object] Array of matching objects
Get Object Requested object
Delete Boolean Will always be true as a failure will throw an error
Update Object The updated object

Error

If an error is encountered Coredna will return an error status code and the object will contain the key error which will contain a string usually providing information on how the error can be fixed.

Example code

To simplify the documentation example responses from resources will only be shown as JSON objects. These responses can be converted to XML using an online tool such as Code Beautify JSON to XML converter.

Status codes

Coredna will return the following status codes on success:

Code Meaning
200 OK - The request was successful
201 Created - The resource was successfully created

Coredna may return the following error status codes:

Code Meaning
400 Bad Request - The request is malformed and won't be accepted until it's fixed
401 Unauthorized - The API key wasn't specified or couldn't be found
404 Not Found - The resource requested can't be found
405 Method Not Allowed - The request type isn't allowed by the resource
500 Internal Server Error - There was a temporary problem with our server, the request should be sent again

Where possible, every error returned by Coredna will be accompanied by a message containing information on how to fix the error encountered.

Searching and pagination

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/resource?parameter=value');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

If we use name_like=d as the parameter/value pair we get back the two records with names containing the letter d

[
    {
        "id": 2,
        "name": "Duff Beer",
        "cost": "26.99",
        "availability": {
            "quantity": "48",
            "status": "in_stock"
        }
    },
    {
        "id": 4,
        "name": "Nuts and Gum",
        "cost": "2.74",
        "availability": {
            "quantity": "0",
            "status": "out_of_stock"
        }
    }
]

We can combine parameters together, using cost_between=1.50,5.00&id_in=3,4,5 will return records which have a cost between $1.50 and $5.00 and an id of 3, 4 or 5

[
    {
        "id": 4,
        "name": "Nuts and Gum",
        "cost": "2.74",
        "availability": {
            "quantity": "0",
            "status": "out_of_stock"
        }
    }
]

We can paginate or limit the results as well, using availabilty[status]=in_stock&limit=3&start=2 will return up to three records with a status of in_stock, skipping the first two records

[
    {
        "id": 3,
        "name": "Buzz Cola",
        "cost": "12.99",
        "availability": {
            "quantity": "100",
            "status": "in_stock"
        }
    },
    {
        "id": 1,
        "name": "Scrabbleships",
        "cost": "28.70",
        "availability": {
            "quantity": "5",
            "status": "in_stock"
        }
    }
]

Unless otherwise specified, Coredna will return nop more than 100 results with get all API request. The results returned can be limited by using searching and pagination. In most cases a more specific data set will be returned much faster than the entire dataset.

Searching

Searches can be performed by passing any field name as a parameter along with an optional operator and a value to search for. To perform a search, append one of more of the following parameters to the URI of any get all API request:

Parameter Value Matches
fieldname x Fields where contents matches x exactly, search is not case sensitive
fieldname_between x,y Fields with contents between x and y - limited to 2 comma-separated values
fieldname_in x,y,z Fields with contents that are either x, y or z - unlimited number of comma-separated values can be passed
fieldname_like x Fields where contents contains x, search is not case sensitive
fieldname_notin x,y,z Fields with content that are not either x, y or z - unlimited number of comma-separated values can be passed

Searching in subfields

Coredna uses arrays for both accepting and returning data. To perform a search on an array the subfield should be passed along with the parent as the parameter in one of two ways:

Type Format Example
Array form field[subfield] price[rrp]=4.99
Dot form field.subfield price.rrp=4.99

Pagination

Pagination can be used on it's own or in conjunction with searching by appending one or more of the follow parameters to the URI of any get all API request:

Parameter Description
limit Limit the number of records returned, by default all records will be returned
start Skip the first x number of records, must be accompanied by a limit

Examples

The code samples provided use the following data:

Id Name Cost Quantity Status
1 Mr Sparkle 4.49 25 in_stock
2 Duff Beer 26.99 48 in_stock
3 Buzz Cola 12.99 100 in_stock
4 Nuts and Gum 2.74 0 out_of_stock
5 Scrabbleships 28.70 5 in_stock

Expanding Objects

Limited endpoints allow you to include (expand) linked objects in the response. This can allow you to reduce the amount of calls to API. This feature can be enabled by providing expand in the query string. Multiple expands can be requested by supplying a comma seperated list of the objects to expand.

Example

The following request could be made https://api.coredna.com/refunds/1234?expand=order,order.items,order.warehouse. The expected response will be a Refund Object. In addition, it will include Order Object (with items) and Warehouse Object.

Assets

{
    "images": {
        "image1": {
            "original": {
              "filename": "image1.jpg",
              "path": "/somepath/",
              "url": "https://r4nd0m.corednacdn.com/somepath/image1.jpg",
              "uri": "/somepath/image1.jpg"
            },
            "small": {
              "filename": "s_image1.jpg",
              "path": "/somepath/",
              "url": "https://r4nd0m.corednacdn.com/somepath/s_image1.jpg",
              "uri": "/somepath/s_image1.jpg"
            },
            "medium": {
              "filename": "m_image1.jpg",
              "path": "/somepath/",
              "url": "https://r4nd0m.corednacdn.com/somepath/m_image1.jpg",
              "uri": "/somepath/m_image1.jpg"
            },
            "thumbnail": {
              "filename": "t_image1.jpg",
              "path": "/somepath/",
              "url": "https://r4nd0m.corednacdn.com/somepath/t_image1.jpg",
              "uri": "/somepath/t_image1.jpg"
            }
        },
        "image2": "",
        "image3": ""
    }
}

All images uploaded to the Coredna API automatically generate several thumbnails of different sizes depending on configuration set in the DXP. Images and other assets returned by the Coredna API are returned as objects containing the different sizes and various components of the uploaded file.

If the CDN is enabled for your website the URL component will contain the full URL to the asset using the CDN, otherwise the URL component will be based on your website. For maximum performance the CDN is recommended.

SEO

{
  "id": "123",
  "title": "My Awesome SEO",
  "description": "Description for my page",
  "keywords": "seo,awesome,docs",
  "robots": "index,follow",
  "module": {
    "name": "ModuleName",
    "type": "ModuleType",
    "id": "ModuleID"
  }
}

A web browsable entity will have related SEO. Currently, products & product categories supports this.

Key Type Description
id Integer Unique identifier for SEO. This is a read only element
title String Title for entity item
description String Description for item
keywords String Comma-seperated list of keywords for item
robots String Robots setting
module Object Unique identifing link to entity item. This is read only

Products

{
    "id": "1234",
    "brand_id": "10",
    "code": "SPARKLE",
    "name": "Mr Sparkle",
    "slug": "mr-sparkle",
    "description": "&lt;p&gt;I'm disrespectful to dirt. Can you see that I am serious? Out of my way, all of you. This is no place for loafers! Join me or die! Can you do any less?&lt;/p&gt;",
    "preview": "&lt;p&gt;I'm disrespectful to dirt. Can you see that I am serious?&lt;/p&gt;",
    "keywords": "Mr Sparkle, Fish Bulb, Detergents",
    "created_at": "2016-06-28 13:35:35",
    "updated_at": "2016-06-28 15:03:59",
    "available": {
        "publish": "on",
        "quantity": "99999",
        "status": "in_stock"
    },
    "images":{
        "image1": {
            "original": {
              "filename": "1234.png",
              "path": "/prodcatalogue/product/",
              "url": "https://r4nd0m.corednacdn.com/prodcatalogue/product/1234.png",
              "uri": "/prodcatalogue/product/1234.png"
            },
            "small": {
              "filename": "s_1234.png",
              "path": "/prodcatalogue/product/",
              "url": "https://r4nd0m.corednacdn.com/prodcatalogue/product/s_1234.png",
              "uri": "/prodcatalogue/product/s_1234.png"
            },
            "medium": {
              "filename": "m_1234.png",
              "path": "/prodcatalogue/product/",
              "url": "https://r4nd0m.corednacdn.com/prodcatalogue/product/m_1234.png",
              "uri": "/prodcatalogue/product/m_1234.png"
            },
            "thumbnail": {
              "filename": "t_1234.png",
              "path": "/prodcatalogue/product/",
              "url": "https://r4nd0m.corednacdn.com/prodcatalogue/product/t_1234.png",
              "uri": "/prodcatalogue/product/t_1234.png"
            }
        },
        "image2": "",
        "image3": "",
        "image4": "",
        "image5": ""
    },
    "limits":{
        "maximum": "12",
        "minimum": "0"
    },
    "prices":{
        "rrp": "29.9500",
        "special": "0.00",
        "cost": "0.00"
    },
    "tax":{
        "code_id": "",
        "class": "15"
    },
    "shipping": {
        "length": "1.23",
        "width": "12.34",
        "depth": "123.45",
        "weight": "99.36"
    },
    "brand": {...},
    "categories": [...],
    "custom_fields": [...],
    "pricing": [...],
    "seo": {...}
}

The product object represents a single product within the catalogue module. Product objects are always returned with any associated brand, category, custom_field and pricing objects.

Key Type Description
id Integer The unique Coredna id for this product
brand_id Integer Associated brand id
code String Unique external identifier
name String Product name
slug String Uri slug to view product
description String Long product description
preview String Short product description
keywords String Comma seperated list of keywords
created_at DateTime The date and time this record was created
updated_at DateTime The date and time this record was last updated
has_inventory Enum Should we track invetory levels for product? Values: '' or 'on'
available Object
   -    publish String Allow product to be viewed/purchased
   -    quantity Integer Quantity available for sale
   -    status String Product status
images Object
   -    image1 Mixed An asset object or an empty string
   -    image2 Mixed An asset object or an empty string
   -    image3 Mixed An asset object or an empty string
   -    image4 Mixed An asset object or an empty string
   -    image5 Mixed An asset object or an empty string
limits Object
   -    maximum Integer The maximum number which can be ordered
   -    minimum Integer The minimum number which must be ordered in a transaction
prices Object
   -    rrp Float Retail price
   -    special Float Special sales price
   -    cost Float Inventory cost price
tax Object
   -    code_id Integer Tax code id
   -    class String Tax class
shipping Object
   -    length Float Length
   -    width Float Width
   -    depth Float Depth
   -    weight Float Weight of single product
   -    ship_separately Enum Should product be shipped separately? Values: 'off' (no) or 'on' (yes)
   -    prevent_splitting Enum Don't allow product to be split in an order? Values: '' (no) or 'on' (yes)
brand Object The associated brand object
categories Array[Object] Array of associated category objects
custom_fields Array[Object] Array of associated custom field objects
pricing Array[Object] Array of associated product pricing objects
seo Object An SEO object associated to product

Create product

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'brand_id' => 10,
    'code' => 'SPARKLE',
    'name' => 'Mr Sparkle',
    'slug' => 'mr-sparkle',
    'description' => '<p>I\'m disrespectful to dirt. Can you see that I am serious? Out of my way, all of you. This is no place for loafers! Join me or die! Can you do any less?</p>',
    'preview' => '<p>I\'m disrespectful to dirt. Can you see that I am serious?</p>',
    'keywords' => 'Mr Sparkle, Fish Bulb, Detergent',
    'available[quantity]' => 99999,
    'images[image1]' => 'http://misutasupakoru.co.jp/images/sparkle1.jpeg',
    'limits[maximum]' => 12,
    'prices[rrp]' => 29.95,
    'tax[class]' => 15,
    'categories' => array(1, 5),
    'custom_fields' => array(
        'Top Loader' => 'true',
        'Front Loader' => 'false'
    ),
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Create a new product in the catalogue.

Parameters

Key Type Description Default
brand_id Integer Associated brand id null
code String Unique external identifier, must be unique Random string
name String Product name, mandatory
slug String Uri slug to view product, must be unique Generated from name or code if no name is given
description String Long product description
preview String Short product description
keywords String Comma seperated list of keywords
available Array
   -    publish Enum Allow product to be viewed/purchased (empty/on) on
   -    quantity Integer Quantity available for sale 0
   -    status Enum Product status (empty/in_stock/out_of_stock) in_stock if quantity given, otherwise out_of_stock
images Array
   -    image1 String Url of first product image, will be downloaded to Coredna, must be jpg/png/gif
   -    image2 String Url of second product image, will be downloaded to Coredna, must be jpg/png/gif
   -    image3 String Url of third product image, will be downloaded to Coredna, must be jpg/png/gif
   -    image4 String Url of fourth product image, will be downloaded to Coredna, must be jpg/png/gif
   -    image5 String Url of fifth product image, will be downloaded to Coredna, must be jpg/png/gif
limits Array
   -    maximum Integer The maximum number which can be ordered, 0 to disable 0
   -    minimum Integer The minimum number which must be ordered in a transaction, 0 to disable 0
prices Array
   -    rrp Float Retail price 0.00
   -    special Float Special sales price 0.00
   -    cost Float Inventory cost price 0.00
tax Array
   -    code_id Integer Tax code id null
   -    class String Tax class
categories Array Array of associated category ids
custom_fields Array Array of custom field key/values
seo Object SEO Settings for product page
   -    title String Product title
   -    description String Description of product
   -    keywords String Comma-seperated keywords
   -    robots String Robots setting for product page

Returned data

The data key will contain the newly created product object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Get product by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/1234');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single product from the catalogue by the unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the product

Returned data

The data key will contain the retrieved product object.

Errors

Status Reason Cause
404 Product not found Product id (id) could not be found, ensure the product id is correct and belongs to your centre

List all products

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all products in the catalogue with optional filtering and pagination.

Returned data

The data key will contain an array of product objects.

Remove product

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/1234');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove a single product from the catalogue.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the product

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
404 Product not found Product id (id) could not be found, ensure the product id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to remove this resource from the database, try again soon

Update product

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'name' => 'Misutā Supākoru',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/1234');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single product.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the product

Parameters

The parameters used when creating a product can be used here.

Returned data

The data key will contain the updated product object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 Product not found Product id (id) could not be found, ensure the product id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Products: Brands

{
    "id": "10",
    "name": "Tamaribuchi Heavy Manufacturing Concern",
    "description": "&lt;p&gt;There's your answer, fishbulb.&lt;/p&gt;",
    "created_at": "2016-06-27 14:22:30",
    "updated_at": "2016-06-27 14:22:30",
    "available": {
        "publish": "on",
        "status": ""
    },
    "comments": {
        "comment1": "",
        "comment2": "",
        "comment3": ""
    },
    "contact": {
        "address": {
            "address": "",
            "postcode": "",
            "state": ""
        },
        "email": "",
        "fax": "",
        "phone": ""
    },
    "images": {
        "image1": {
            "original": {
                "filename": "10.png",
                "path": "/web_images/brands/",
                "url": "https://r4nd0m.corednacdn.com/web_images/brands/10.png",
                "uri": "/web_images/brands/10.png"
            },
            "small": {
                "filename": "s_10.png",
                "path": "/web_images/brands/",
                "url": "https://r4nd0m.corednacdn.com/web_images/brands/s_10.png",
                "uri": "/web_images/brands/s_10.png"
            },
            "medium": {
                "filename": "m_10.png",
                "path": "/web_images/brands/",
                "url": "https://r4nd0m.corednacdn.com/web_images/brands/m_10.png",
                "uri": "/web_images/brands/m_10.png"
            },
            "thumbnail": {
                "filename": "t_10.png",
                "path": "/web_images/brands/",
                "url": "https://r4nd0m.corednacdn.com/web_images/brands/t_10.png",
                "uri": "/web_images/brands/t_10.png"
            },
        },
        "image2": ""
    }
}

The brand object represents a single brand within the catalogue module.

Key Type Description
id Integer The unique Coredna id for this brand
name String Brand name, mandatory
description String Description or tagline for the brand
created_at DateTime The date and time this record was created
updated_at DateTime The date and time this record was last updated
available Object
   -    publish String Allow brand to be viewed/associated with a product
   -    status String Brand status
comments Object
   -    comment1 String A free text comment for this brand
   -    comment2 String Another free text comment for this brand
   -    comment3 String Another free text comment for this brand
contact Object
   -    address Object
            -    address String Street address for this brand
            -    postcode String Postcode for this brand
            -    state String State for this brand
   -    email String Email contact for this brand
   -    fax String Fax number for this brand
   -    phone String Phone number for this brand
images Object
   -    image1 String An asset object or an empty string
   -    image2 String An asset object or an empty string

Create brand

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'name' => 'Tamaribuchi Heavy Manufacturing Concern',
    'description' => '<p>There\'s your answer, fishbulb.</p>',
    'images[image1]' => 'http://misutasupakoru.co.jp/images/fishbulb.png',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/brands');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Create a new brand in the catalogue.

Parameters

Key Type Description Default
name String Brand name
description String Description or tagline for the brand
available Array
   -    publish Enum Allow brand to be viewed/associated with a product (empty/on) empty
   -    status Enum Brand status (empty) empty
comments Array
   -    comment1 String A free text comment for this brand
   -    comment2 String Another free text comment for this brand
   -    comment3 String Another free text comment for this brand
contact Array
   -    address Array
            -    address String Street address for this brand
            -    postcode String Postcode for this brand
            -    state String State for this brand
   -    email String Email contact for this brand
   -    fax String Fax number for this brand
   -    phone String Phone number for this brand
images Array
   -    image1 String Url of first brand image, will be downloaded to Coredna, must be jpg/png/gif
   -    image2 String Url of second brand image, will be downloaded to Coredna, must be jpg/png/gif

Returned data

The data key will contain the newly created brand object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Get brand by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/brands/10');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single brand from the catalogue by the unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the brand

Returned data

The data key will contain the retrieved brand object.

Errors

Status Reason Cause
404 Brand not found Brand id (id) could not be found, ensure the brand id is correct and belongs to your centre

List all brands

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/brands');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all brands in the catalogue with optional filtering and pagination.

Returned data

The data key will contain an array of brand objects.

Remove brand

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/brands/12');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove a single brand from the catalogue.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the brand

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
404 Brand not found Brand id (id) could not be found, ensure the brand id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to remove this resource from the database, try again soon

Update brand

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'name' => 'Matsumura Fishworks and Tamaribuchi Heavy Manufacturing Concern',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/brands/12');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single brand.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the brand

Parameters

The parameters used when creating a brand can be used here.

Returned data

The data key will contain the updated brand object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 Brand not found Brand id (id) could not be found, ensure the brand id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Remove product brand

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'brand_id' => 0,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/1234');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove the association between a brand and a product in the catalogue.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the brand

Parameters

Since this is simply a product update, you can use any parameter available in update product, to remove the brand you just need to zero out the brand id.

Key Type Description
brand_id Integer Associated brand id

Returned data

Since this is simply a product update, the updated product object will be returned.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 Product not found Product id (id) could not be found, ensure the product id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Products: Categories

{
    "id": "1",
  "name": "Detergents",
  "slug": "detergents",
  "description": "&lt;p&gt;Detergents and soaps for washing machines.&lt;/p&gt;",
  "keywords": "",
  "created_at": "2016-06-27 14:22:30",
  "updated_at": "2016-06-27 14:22:30",
  "available": {
    "publish": "on",
    "status": "published"
  },
  "comments": {
    "comment1": "",
    "comment2": "",
    "comment3": "",
    "comment4": "",
    "comment5": ""
  },
  "images": {
    "image1": {
      "original": {
        "filename": "1.png",
        "path": "/prodcatalogue/category/1/",
        "url": "https://r4nd0m.corednacdn.com/prodcatalogue/category/1/1.png",
        "uri": "/prodcatalogue/category/1/1.png"
      },
      "small": {
        "filename": "s_1.png",
        "path": "/prodcatalogue/category/1/",
        "url": "https://r4nd0m.corednacdn.com/prodcatalogue/category/1/s_1.png",
        "uri": "/prodcatalogue/category/1/s_1.png"
      },
      "medium": {
        "filename": "m_1.png",
        "path": "/prodcatalogue/category/1/",
        "url": "https://r4nd0m.corednacdn.com/prodcatalogue/category/1/m_1.png",
        "uri": "/prodcatalogue/category/1/m_1.png"
      }
    }
  },
  "seo": {
    ...
  }
}

The category object represents a single category within the catalogue module.

Key Type Description
id Integer The unique Coredna id for this category
name String Category name
slug String Uri slug to view this category
description String Description or tagline for this category
keywords String Comma seperated list of keywords
created_at DateTime The date and time this record was created
updated_at DateTime The date and time this record was last updated
available Object
   -    publish String Allow category to be viewed
   -    status String Category status
comments Object
   -    comment1 String A free text comment for this category
   -    comment2 String Another free text comment for this category
   -    comment3 String Another free text comment for this category
   -    comment4 String Another free text comment for this category
   -    comment5 String Another free text comment for this category
images Object
   -    image1 String An asset object or an empty string
seo Object An SEO object associated to the category

Create category

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'name' => 'Detergents',
    'slug' => 'detergents',
    'description' => '<p>Detergents and soaps for washing machines.</p>',
    'images[image1]' => 'http://misutasupakoru.co.jp/images/categories/detergents.jpg',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/categories');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Create a new category in the catalogue.

Parameters

Key Type Description Default
name String Category name, mandatory
slug String Uri slug to view this category, must be unique
description String Description or tagline for this category
keywords String Comma seperated list of keywords
available Array
   -    publish Enum Allow category to be viewed/associated with a product (empty/on) on
   -    status Enum Category status (empty/for_approval/approved/published/archived) for_approval
comments Array
   -    comment1 String A free text comment for this category
   -    comment2 String Another free text comment for this category
   -    comment3 String Another free text comment for this category
   -    comment4 String Another free text comment for this category
   -    comment5 String Another free text comment for this category
images Array
   -    image1 String Url of first category image, will be downloaded to Coredna, must be jpg/png/gif
seo Object SEO Settings for product page
   -    title String Category title
   -    description String Description of category
   -    keywords String Comma-seperated keywords
   -    robots String Robots setting for category page

Returned data

The data key will contain the newly created category object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Get category by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/categories/1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single category from the catalogue by the unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the category

Returned data

The data key will contain the retrieved category object.

Errors

Status Reason Cause
404 Category not found Category id (id) could not be found, ensure the category id is correct and belongs to your centre

List all categories

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/categories');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all categories in the catalogue with optional filtering and pagination.

Returned data

The data key will contain an array of category objects.

Remove category

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/categories/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove a single category from the catalogue.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the category

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
404 Category not found Category id (id) could not be found, ensure the category id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to remove this resource from the database, try again soon

Update category

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'name' => 'Detergents and Soaps',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/categories/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single category.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the category

Parameters

The parameters used when creating a category can be used here.

Returned data

The data key will contain the updated category object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 Category not found Category id (id) could not be found, ensure the category id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Remove product category

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/1234/category/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove the association between a category and a product in the catalogue.

Query Parameters

Key Type Description
product_id Integer The unique Coredna id for the product
id Integer The unique Coredna id for the category

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
400 Data validation error Category id specified is invalid or does not belong to product
500 Internal database error There was an error encountered when attempting to remove this link from the database, try again soon

Products: Custom Fields

{
    "id": "10902",
    "name": "Machine Type",
    "description": "Define the machine type this detergent is compatible with.",
    "available": {
        "status": "active"
    }
}

The custom field object represents a single custom field within the catalogue module.

Key Type Description
id Integer The unique Coredna id for this custom field
name String Custom field name
description String Description of what the custom field is used for
available Object
   -    status String Custom field status

Create custom field

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'name' => 'Machine Type',
    'description' => 'Define the machine type this detergent is compatible with.',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/custom_fields');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Create a new custom field in the catalogue.

Parameters

Key Type Description Default
name String Custom field name, mandatory
description String Description of what the custom field is used for
available Array
   -    status Enum Custom field status (empty/active) active

Returned data

The data key will contain the newly created custom field object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Get custom field by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/custom_fields/10902');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single custom field from the catalogue by the unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the custom field

Returned data

The data key will contain the retrieved custom field object.

Errors

Status Reason Cause
404 Custom field not found Custom field (id) could not be found, ensure the custom field id is correct and belongs to your centre

List all custom fields

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/custom_fields');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all custom fields in the catalogue with optional filtering and pagination.

Returned data

The data key will contain an array of custom field objects.

Remove custom field

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/custom_fields/10902');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove a single custom field from the catalogue.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the custom field

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
404 Custom field not found Custom field id (id) could not be found, ensure the custom field id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to remove this resource from the database, try again soon

Update custom field

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'name' => 'Detergents and Soaps',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/custom_fields/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single custom field.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the custom field

Parameters

The parameters used when creating a custom field can be used here.

Returned data

The data key will contain the updated custom field object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 Custom field not found Custom field id (id) could not be found, ensure the custom field id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Update product value

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'value' => 'Top Loader'
)

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/1234/custom_fields/10902');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update the value of a specific custom field attached to a single product in the catalogue.

Query Parameters

Key Type Description
product_id Integer The unique Coredna id for the product
id Integer The unique Coredna id for the category

Parameters

Key Type Description
value String The value to assign to the custom field

Returned data

The data key will contain the updated custom field object.

Products: Variants

Variant Object

{
  "id": "20282",
  "product_id": "4603286",
  "code": "001",
  "name": "Stainless Steel",
  "description": "The Ring of Power in Stainless Steel",
  "publish": "on",
  "stock": "10"
}

The Variant object represents a single variant within the catalogue module.

Field Type Editable Description
id Integer No The unique Coredna id of the variant
product_id Integer No The unique Coredna id of the parent product
code String Yes The unique code of the variant (e.g. SKU code)
name String Yes Short description or tagline of the variant
description String Yes Full Description of the variant
publish Enum Yes Possible values: "" (empty string) - variant is not displayed to the public, "on" - variant is enabled
stock Integer Yes Quantity of the variant of the product available for sale

Get Variant by Id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/products/variants/20282');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);
<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/products/4603286/variants/20282');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single variant from the catalogue by id:

Get a single variant from the catalogue by id and parent product id:

Query Parameters

Key Type Description
id Integer The unique Coredna id of the Variant
product_id Integer The unique Coredna id of the product (optional)

Returned data

The data key will contain the retrieved Variant object.

List All Variants

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/variants');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all variants in the catalogue with optional filtering and pagination.

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/4603286/variants');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all variants of the given product with optional filtering and pagination.

Query Parameters

Key Type Description
product_id Integer The unique Coredna id of the product (optional)

Returned data

The data key will contain an array of Variant objects.

Update Variant by Id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'stock' => 54,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/variants/12');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single Variant by Id

Query Parameters

Key Type Description
id Integer The unique Coredna id of the Variant

Parameters

All editable fields of the Variant can be used in the update payload.

Returned data

The data key will contain the updated Variant object.

Update Variant by Code (SKU)

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'publish' => 'on',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/variants?code=001-123-456');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single Variant by its code

Query Parameters

Key Type Description
code String The unique code of the Variant assigned by the user (e.g. SKU)

Parameters

All editable fields of the Variant can be used in the update payload.

Returned data

The data key will contain the array of all updated Variant objects. Note, though the REST API imposes a uniqueness requirement for the code field, this can be overridden through the DXP. Therefore, more than one record may be updated with such query.

Products: Pricings

{
  "id": "3",
  "product_id": "1",
  "name": "",
  "description": "Added via Postman",
  "sign": "",
  "price": "1966.45",
  "modifier": "$",
  "publish": "on",
  "minimum_qty": "10"
}

The pricing object represents a single pricing group for a product.

Key Type Description
id Integer The unique Coredna id for this pricing
product_id Integer The unique Coredna product id which this pricing relates to
name String Optional name
description String Optional text/description
sign String Must have one of the following values:
+
Add pricing
-
Subtract pricing
(empty string)
(default) Absolute pricing
price Float Positive number
modifier String Must be one of:
$
(default) Fixed pricing
%
Percentage based pricing
publish String Toggle to enable/disable pricing. Default on (enabled). Explicitly set '' (empty string) to disabled.
minimum_qty Integer Used with quantity based discounts. Sets minimum quantity to be included.

Create pricing

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'product_id' => '1',
    'description' => 'Min x10 pricing',
    'price' => '1966.45',
    'minimum_qty' => '10',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/pricings');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Create a new pricing for a product.

Parameters

Key Type Description Default
product_id Integer Unique product identifier, mandatory
name String Optional name
description String Optional description
sign String +, - or (empty string) (empty string)
price Float Positive number for pricing, mandatory
modifier String $ or % $
publish Sting on or (empty string) on
minimum_qty Integer Positive number 0

Returned data

The data key will contain the newly created pricing object.

Errors

Status Reason Cause
400 Data validation error Data provided doesn't pass validation. Please check submitted data.
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Get pricing by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/pricings/1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single pricing by the unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the pricing

Returned data

The data key will contain the retrieved pricing object.

Errors

Status Reason Cause
404 Pricing not found Pricing id (id) could not be found, ensure the pricing id is correct and belongs to your centre

List all pricing

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/pricings');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all pricings with optional filtering and pagination.

Returned data

The data key will contain an array of pricing objects.

List all pricing for a product

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/1/pricings');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all pricings for a product with optional filtering and pagination.

Query Parameters

Key Type Description
product_id Integer The unique Coredna id for the product

Returned data

The data key will contain an array of pricing objects.

Remove pricing

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/pricings/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove a single pricing.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the pricing

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
404 Pricing not found Pricing id (id) could not be found, ensure the pricing id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to remove this resource from the database, try again soon

Update pricing

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'price' => '1699.21',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/products/pricings/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single pricing.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the pricing

Parameters

The parameters used when creating a pricing can be used here.

Returned data

The data key will contain the updated pricing object.

Errors

Status Reason Cause
400 Data validation error Data provided doesn't pass validation. Please check submitted data.
404 Pricing not found Pricing id (id) could not be found, ensure the pricing id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Orders

{
    "id": "123456",
    "parent_id": "789",
    "number": "5",
    "user_id": "348",
    "comments": "",
    "status": "shipped",
    "created_at": "2016-09-15 16:47:39",
    "updated_at": "2016-09-17 09:14:32",
    "addresses": {
        "billing": {
            "name": "Homer Simpson",
            "company": "",
            "address": "742 Evergreen Terrace",
            "suburb": "",
            "city": "Springfield",
            "state": "XX",
            "postcode": "00010",
            "email": "hsimpson@springfieldnuclear.com",
            "phone": "189844357489"
        },
        "delivery": {
            "name": "Homer Simpson",
            "company": "",
            "address": "742 Evergreen Terrace",
            "suburb": "",
            "city": "Springfield",
            "state": "XX",
            "postcode": "00010",
            "email": "hsimpson@springfieldnuclear.com",
            "phone": "189844357489"
        }
    },
    "custom": {
        "custom1": "",
        "custom2": "",
        "custom3": "",
        "custom4": "",
        "custom5": "",
        "custom6": "",
        "custom7": "",
        "custom8": "",
        "custom9": "",
        "custom10": ""
    },
    "payment": {
        "method": "Pay By Paypal",
        "transaction_id": "10308"
    },
    "shipping": {
        "method": "USPS Saver",
        "tracking_id": "SIM102938AU",
        "carrier": "USPS",
        "date": "2016-09-17 09:14:32"
    },
    "totals": {
        "delivery": "10.0000",
        "insurance": "0.0000",
        "surcharge": "0.0000",
        "discount": "0.0000",
        "tax": "0.9091",
        "total": "23.9500"
    },
    "items": [
      {
        "type": "product",
        "id": "123",
        "code": "10-01693-001",
        "variant": {
            "id": "123123",
            "code": "K05-09-1989",
            "name": "Test variant 1"
        },
        "name": "My Test Product",
        "quantity": "1",
        "unit_price": "20.0000",
        "discount": "0.0000",
        "tax": "2.0000",
        "options": {
            "Colour": "Red",
            "Size": "XL"
        }
      },
      {
        "type": "bundle",
        "id": "777",
        "name": "Gift Pack",
        "quantity": "2",
        "unit_price": "60.00",
        "discount": "0.0000",
        "tax": "6.0000",
        "products": [
          {
            "type": "product",
            "id": "123",
            "code": "10-01693-001",
            "variant": {
                "id": "123123",
                "code": "K05-0919-89",
                "name": "Test variant 1"
            },
            "name": "My Test Product",
            "quantity": "2",
            "unit_price": "20.0000",
            "discount": "0.0000",
            "tax": "2.0000",
            "options": {
                "Colour": "Red",
                "Size": "XL"
            }
          },
          {
            "type": "product",
            "id": "456",
            "code": "10-01693-002",
            "variant": {
                "id": "123124",
                "code": "Z10-1219-89",
                "name": "Test variant 2"
            },
            "name": "My Second Test Product",
            "quantity": "1",
            "unit_price": "40.00",
            "discount": "10.0000",
            "tax": "3.0000",
            "options": {
                "Colour": "Yellow",
                "Size": "S"
            }
          }
        ]
      }
    ],
    "has_children": "true",
    "has_parent": "false",
    "children": [
      123,
      456
    ]
}

The order object represents a single order within the catalogue module.

Field Type Editable Description
id Integer No The unique Coredna id for this order
parent_id Integer No The unique Coredna id for the order parent
number String No The sequence number for this order
user_id Integer No User id of person who created order
comments String Yes Comments for this order
status String Yes Possible values: 'cancelled', 'shipped', 'completed', 'declined', 'new', 'inprogress'
created_at DateTime No The date and time this record was created
updated_at DateTime No The date and time this record was last updated
addresses Object
   -    billing Object
            -    name String Yes Billing name
            -    company String Yes Billing company name
            -    address String Yes Billing street address
            -    suburb String Yes Billing suburb or address2
            -    city String Yes Billing city
            -    state String Yes Billing state
            -    postcode String Yes Billing postcode
            -    email String Yes Billing email
            -    phone String Yes Billing phone
   -    delivery Object
            -    name String Yes Delivery name
            -    company String Yes Delivery company name
            -    address String Yes Delivery street address
            -    suburb String Yes Delivery suburb or address2
            -    city String Yes Delivery city
            -    state String Yes Delivery state
            -    postcode String Yes Delivery postcode
            -    email String Yes Delivery email
            -    phone String Yes Delivery phone
custom Object
   -    custom1 String Yes Custom field to store any information
   -    custom2 String Yes Custom field to store any information
   -    custom3 String Yes Custom field to store any information
   -    custom4 String Yes Custom field to store any information
   -    custom5 String Yes Custom field to store any information
   -    custom6 String Yes Custom field to store any information
   -    custom7 String Yes Custom field to store any information
   -    custom8 String Yes Custom field to store any information
   -    custom9 String Yes Custom field to store any information
   -    custom10 String Yes Custom field to store any information
payment Object
   -    method String No How the order was paid for
   -    transaction_id String No The id of the payment gateway used for the order
shipping Object
   -    method String No How the order was sent
   -    tracking_id String Yes The tracking id used to send the order
   -    carrier String Yes Carrier name
   -    date DateTime Yes Shipping date
totals Object
   -    delivery Float No Delivery portion of the total
   -    insurance Float No Insurance portion of the total
   -    surcharge Float No Surcharge portion of the total
   -    discount Float No How much discount has been applied to the order
   -    tax Float No Tax portion of the total if tax inclusive, otherwise tax for the order
   -    total Float No Total order cost
items Array
   -    type String No Type of the order item
   -    id Integer No Id of the item
   -    code String No Code of the item (products only)
   -    variant Array No Variant info for the item (products only)
            -    id String No Variant id
            -    code String No Variant code
            -    name String No Variant name
   -    name String No Name of the item
   -    quantity Integer No Quantity of this item included in the order
   -    unit_price Float No Price per item unit
   -    discount Float No Discount per item unit
   -    tax Float No Tax per item unit
   -    products Array No Products included in this item (bundles only)
   -    options Object No Selected options for this item (products only)
has_children Boolean No Flag reporting if this order has any child orders. (default false)
has_parent Boolean No Flag reporting if this order has a parent order. (default false)
children Array No List of order ids which are children of this order.

Get order by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders/123456');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single order from the catalogue by the unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the order

Returned data

The data key will contain the retrieved order object.

Errors

Status Reason Cause
404 Order not found Order id (id) could not be found, ensure the order id is correct and belongs to your centre

List all orders

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all orders in the catalogue with optional filtering and pagination.

Returned data

The data key will contain an array of order objects.

Remove order

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders/123456');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove a single order from the catalogue.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the order

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
404 Order not found Order id (id) could not be found, ensure the order id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to remove this resource from the database, try again soon

Update order

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'comments' => 'Authority to leave at front door',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders/123456');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single order.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the order

Parameters

All editable fields of the Order object can be used.

Returned data

The data key will contain the updated Order object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 Order not found Order id (id) could not be found, ensure the order id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Count all orders

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders/count');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a count of orders. Can be combined with filtering (no pagination).

Returned data

The data key will contain an array with record count for request.

Key Type Description
count Integer The number of records
{
  "count": "48"
}

Orders: Payment Transactions

Payment Transaction Object

{
  "id": "49",
  "order_id": "46",
  "date": "2018-08-24 12:59:22",
  "status": "success",
  "amount": "35.00",
  "gateway": "GATEWAY_XYZ",
  "response": {
    "gw_ResponseCode": "00",
    "gw_Amount": "3500",
    "gw_AuthorizeId": "057806212",
    "gw_BatchNo": "20180801",
    "gw_MerchTxnRef": "myref123",
    "gw_Merchant": "HORNSANDHOOVES",
    "gw_Message": "Approved",
    "gw_ReceiptNo": "180814130407",
    "gw_TransactionNo": "2070000108",
  }
}

The Payment Transaction object represents a payment transaction made to purchase something in the eCommerce module. One order may have many payment transactions liked to it.

Field Type Editable Description
id Integer No The unique Coredna id of the payment transaction
order_id Integer No The unique Coredna id of the order
date DateTime No Timestamp of the transaction
status Enum No Possible values: "pending", "success", "fail"
amount Currency No Transaction amount
gateway String No The unique Coredna identifier of the payment method (gateway) used
response Array No Raw response data from the payment gateway (different for each gateway)

List Transactions for the Order

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders/46/transactions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all payment transactions for the given order

Query Parameters

Key Type Description
order_id Integer The unique Coredna id of the Order

Returned data

The data key will contain an array of Payment Transaction objects.

Orders: Logs

Logs Object

{
  "id": 424234,
  "order_id": 56456456,
  "created_at": "2024-06-19 20:35:43",
  "user": "Tom Jones (26776)",
  "source": "Portal",
  "action": "Order Create by Checkout",
  "data": {
    "extraData": {
      "new": "Checkout was created successfully"
    }
  },
  "result": true
}

The Log object represents an update to the order.

Field Type Editable Description
id Integer No The unique Coredna id of the log
order_id Integer No The unique Coredna id of the order
created_at DateTime No Timestamp when the log was created
user String No Representation of who updated the order
source String No Source of the change
action String No Summary of the update
data Array No Snapshot of data changed. Each key must at least have an array value with a new key
result Boolean No Was the result successful?

Create log

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'action' => 'External Integration Update',
    'data' => [
        'externalId' => [
            'new' => 12345664
        ],
        'status' => [
            'old' => 'new',
            'new' => 'shipped'
        ]
    ],
    'result' => true
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders/123/logs');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Create a log for an order.

Parameters

Key Type Description
action String Summary or reason for the update
data Array Summary of data modified
result Boolean Was the update successful?

Returned data

The data key will contain the newly created log object.

Errors

Status Reason Cause
400 Data validation error Value given for data is invalid and can not be saved in the database
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Get log by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders/123/logs/553');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get an order log.

Query Parameters

Key Type Description
order_id Integer The unique Coredna id for the order which this log belongs to
id Integer The unique Coredna id for the log

Returned data

The data key will contain the retrieved log object.

Errors

Status Reason Cause
404 Log not found Log id (id) could not be found or does not belong to order id (order_id), ensure the log id is correct and belongs to your centre

List Logs for the Order

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/orders/123/logs');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all logs for the given order

Query Parameters

Key Type Description
order_id Integer The unique Coredna id of the Log

Returned data

The data key will contain an array of Logs objects.

Refunds

Refund Object

{
  "id": 1377,
  "order_id": 359462,
  "user_id": 1000558,
  "parent_id": 0,
  "status": "success",
  "transaction_id": 79468,
  "transaction_identifier": "7a47366b-5049-4852-9a43-6c697570536d",
  "notes": "",
  "created": "2024-07-08 08:52:33",
  "refunded": "2024-07-08 08:52:33",
  "total": {
    "items": "32.9500",
    "shipping": "7.8500",
    "total": "40.8000"
  },
  "items": [
    {
      "id": 2065,
      "refund_id": 1377,
      "type": "product",
      "order_product_id": 79162,
      "qty": 1,
      "amount": "32.9500"
    },
    {
      "id": 2066,
      "refund_id": 1377,
      "type": "shipping",
      "order_product_id": 0,
      "qty": 1,
      "amount": "7.8500"
    }
  ]
}

The Refund object represents a refund to an order.

Field Type Editable Description
id Integer No The unique Coredna id of the refund
order_id Integer No The unique Coredna id of the order
user_id Integer No The unique Coredna id of the user who created this refund
parent_id Integer No The id of the parent refund
status Enum No Status of the refund. Values: draft, success, error
total Object No
   -    items Float No Total refunded for products
   -    shipping Float No Total refunded for shipping. This might be a negative value indicating a shipping charge was encountered.
   -    total Float No Refund total. Should be items + shipping.
transaction_id Integer No Coredna id of the refund transaction
transaction_identifier String No Payment method identifier for the refund transaction
notes String No Optional notes regarding the refund
created Datetime No When the refund was created
refunded Datetime No When the refund was processed
items Array of refunded items No List of items which was refunded

Refunded Items Object

{
  "id": 2065,
  "refund_id": 1377,
  "type": "product",
  "order_product_id": 79162,
  "qty": 1,
  "amount": "32.9500"
}
Field Type Editable Description
id Integer No The unique Coredna id of the refunded item
refund_id Integer No Coredna id of the refund
type Enum No Item type. Values: product, shipping
order_product_id Integer No Coredna id of the order product
qty Integer No Quantity being refunded
amount Float No Total amount being refunded for this item

Get refund by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/refunds/123456');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single order refund by the unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the refund
expand String Expand linked objects in response. Supported expands: transaction, order, order.items, order.warehouse

Returned data

The data key will contain the retrieved refund object.

Errors

Status Reason Cause
404 Refund not found Refund id (id) could not be found, ensure the refund id is correct and belongs to your centre

List all refunds

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/refunds');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all orders in the catalogue with optional filtering and pagination.

Returned data

The data key will contain an array of refund objects.

Subscription: Users

Subscription User Object

{
  "id": 424234,
  "user_id": 56456456,
  "subscription_id": 2234,
  "start": "2024-08-30 12:22:33",
  "end": null,
  "status": {
    "active": true,
    "payment": true
  },
  "next_order_id": 1255433,
  "next_billing_date": "2024-09-29 10:00:00",
  "created_at": "2024-08-30 12:22:33",
  "updated_at": "2024-08-30 12:22:33"
}

The User object represents an update to the order.

Field Type Editable Description
id Integer No The unique Coredna id of the subscription user
user_id Integer No The unique Coredna id of the user
subscription_id Integer No The unique Coredna id of the subscription
start DateTime No When their subscription stated
end DateTime or null No When their subscription will end. null has meaning of indefinite.
status Object No
   -    active Boolean No Is this active?
   -    payment Boolean No Is this subscription up to date with payments?
next_order_id Integer No Next child order for the subscription
next_billing_date DateTime No When is the next billing period?
created_at DateTime No The date and time this record was created
updated_at DateTime No The date and time this record was last updated

Get a subscription user by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/subscriptions/users/1234');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single subscription user.

Query Parameters

Key Type Description
id String The unique Coredna id for the subscription user

Returned data

The data key will contain the retrieved subscription user object.

Errors

Status Reason Cause
404 Not found There is no subscription user matching this id

Warehouses

{
  "id": "1234",
  "name": "Melbourne Warehouse",
  "code": "MELBOURNE",
  "created_at": "2023-02-27 21:56:08",
  "updated_at": "2023-02-27 21:56:08"
}

The warehouse object represents a single inventory warehouse.

Key Type Description
id Integer The unique Coredna id for this warehouse
name String Warehouse name
code String Unique external identifier
created_at DateTime The date and time this record was created
updated_at DateTime The date and time this record was last updated

Get warehouse by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/warehouses/1234');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single warehouse by the unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the warehouse

Returned data

The data key will contain the retrieved warehouse object.

Errors

Status Reason Cause
404 Warehouse not found Warehouse id (id) could not be found, ensure the warehouse id is correct and belongs to your centre

List all warehouses

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/warehouses');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all warehouses with optional filtering and pagination.

Returned data

The data key will contain an array of warehouse objects.

Users

{
  "id": "18986",
  "username": "joe.bloggs@example.com",
  "email": "joe.bloggs@example.com",
  "url": "",
  "gender": "",
  "dob": "2021-07-22",
  "status": "active",
  "comment": "",
  "created_at": "2021-07-22 17:46:15",
  "updated_at": "2021-07-22 17:49:19",
  "name": {
    "title": "",
    "firstname": "Joe",
    "lastname": "Bloggs",
    "nickname": ""
  },
  "address": {
    "country_id": "AU",
    "state_id": "Victoria",
    "suburb": "Prahran",
    "city": "",
    "postcode": "3181",
    "unit": "",
    "address1": "123 Test Way",
    "address2": "",
    "address3": ""
  },
  "phone": {
    "day": "123456789",
    "evening": "",
    "fax": ""
  },
  "work": {
    "occupation": "",
    "company": "",
    "buscat": "",
    "jobdpt": ""
  },
  "custom": {
    "custom1": "45454545",
    "custom2": "123456789",
    "custom3": "Master",
    "custom4": "",
    "custom5": "999999999"
  }
}

The user object represents a single user which has the following properties.

Key Type Editable Description
id Integer No Unique Coredna identifier for the user
username String No Username for user
email String Yes Email address
url String Yes Url related to user
gender String Yes User's gender
dob Date Yes Date of birth
status String No Status of the user
comment String Yes Comment
name Object
   -    title String Yes Title (eg Mr, Ms, Mrs, etc)
   -    firstname String Yes First name
   -    lastname String Yes Surname or last name
   -    nickname String Yes Nickname
address Object
   -    country_id String Yes Country
   -    state_id String Yes State/Providence
   -    suburb String Yes Suburb/Town
   -    city String Yes City
   -    postcode String Yes Postcode/zipcode
   -    unit String Yes Unit/Apartment #
   -    address1 String Yes 1st address line
   -    address2 String Yes 2nd address line
   -    address3 String Yes 3rd address line
phone Object
   -    day String Yes Daytime phone number
   -    evening String Yes Evening phone number
   -    fax String Yes Fax number
work Object
   -    occupation String Yes Occupation
   -    company String Yes Company
   -    buscat String Yes Business industry
   -    jobdpt String Yes Job function/Department
custom Object
   -    custom1 String Yes Custom data field
   -    custom2 String Yes Custom data field
   -    custom3 String Yes Custom data field
   -    custom4 String Yes Custom data field
   -    custom5 String Yes Custom data field
created_at DateTime No When user was created
updated_at DateTime No When user was last updated

Get user by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users/123456');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single user by their unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the user

Returned data

The data key will contain the retrieved user object.

Errors

Status Reason Cause
404 User not found User id (id) could not be found, ensure the user id is correct and belongs to your centre

List all users

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all users with optional filtering and pagination.

Returned data

The data key will contain an array of user objects.

Remove user

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users/123456');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove a single user.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the user

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
404 User not found User id (id) could not be found, ensure the user id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to remove this resource from the database, try again soon

Update user

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'comment' => 'This user is awesome!',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users/123456');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single user.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the user

Parameters

All editable fields of the User object can be used.

Returned data

The data key will contain the updated User object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 User not found User id (id) could not be found, ensure the user id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Count all users

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users/count');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a count of users. Can be combined with filtering (no pagination).

Returned data

The data key will contain an array with record count for request.

Key Type Description
count Integer The number of records
{
  "count": "206"
}

User Notifications

{
  "id": "5",
  "user_id": "3",
  "from": "Postman!",
  "content": "New notification created via API",
  "read_at": "",
  "created_at": "2021-07-29 10:14:55",
  "updated_at": "2021-07-29 10:22:23",
  "deleted_at": ""
}

The user notification object represents a single notification which has the following properties.

Key Type Editable Description
id Integer No Unique Coredna identifier for the notification
user_id Integer Yes Coredna user identifier
from String Yes Which part of system notification was created
content String Yes Text content of notification
read_at DateTime Yes When notification was marked as read. null indicates it hasn't been read.
created_at DateTime No When notification was created
updated_at DateTime No Last time notification was updated
deleted_at DateTime No When notification was deleted. This will always be null.

List all notifications

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users/notifications');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get all user notifications with optional filtering and pagination.

Returned data

The data key will contain an array of user notification objects.

List all notifications for a user

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users/12345/notifications');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all users' notifications with optional filtering and pagination.

Query Parameters

Key Type Description
user id Integer The unique Coredna id for the user

Returned data

The data key will contain an array of user notification objects.

Create notification

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'user_id' => 123456,
    'from' => 'Postman!',
    'content' => 'New notification from API!',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users/notifications');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Create a new user notification.

Parameters

Key Type Description Default
user_id Integer Coredna user id
from String Where in system notification is from Blank string
content String Text content of notification
read_at DateTime When user has read notification null

Returned data

The data key will contain the newly created notification object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Remove notification

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/user/notification/123456');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Remove a single user notification.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the notification

Returned data

The data key will always contain a result of true as any error will cause the error message to be returned instead.

Errors

Status Reason Cause
404 Notification not found Notification id (id) could not be found, ensure the notification id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to remove this resource from the database, try again soon

Update notification

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'read_at' => '2021-07-29 12:00:00'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/users/notification/123456');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single notification.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the notification

Parameters

All editable fields of the Notification object can be used.

Returned data

The data key will contain the updated Notification object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 Notification not found Notification id (id) could not be found, ensure the notification id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon

Groups

{
  "id": "3",
  "name": "sales_team",
  "status": "active",
  "interest": "",
  "comment": "Sales Team",
  "members": [
    "15",
    "5",
    "7",
    "96",
    "15699",
    "22",
    "15696"
  ],
  "owners": [
    "5",
    "7"
  ]
}

The group object represents a single user group which has the following properties.

Key Type Editable Description
id Integer No Unique Coredna identifier for the group
name String Yes Name of group
status String No Status of group
interest Enum Yes Is interest group? Values: blank or 'on'
comment String Yes Group comment
members Array No List of group members (user ids)
owners Array No List of group owners (user ids)

For performance reasons, members & owners are only available when fetching single record.

Get group by id

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/groups/123');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a single group by their unique Coredna id.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the group

Returned data

The data key will contain the retrieved group object.

Errors

Status Reason Cause
404 Group not found Group id (id) could not be found, ensure the group id is correct and belongs to your centre

List all groups

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/groups');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Get a list of all groups with optional filtering and pagination.

Returned data

The data key will contain an array of group objects excluding members & owners.

Update group

<?php

$headers = array(
    'Authorization: Bearer youruniqueapikey',
    'Accept: application/json'
);

$data = array(
    'comment' => 'Sales team group',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.coredna.com/group/123');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($ch);

Update a single group.

Query Parameters

Key Type Description
id Integer The unique Coredna id for the group

Parameters

All editable fields of the Group object can be used.

Returned data

The data key will contain the updated Group object.

Errors

Status Reason Cause
400 Data validation error Value given for key is invalid and can not be saved in the database
404 Group not found Group id (id) could not be found, ensure the group id is correct and belongs to your centre
500 Internal database error There was an error encountered when attempting to save this resource to the database, try again soon
php