Simple, RESTful API, to receive orders from LivePepper
The purpose of this document is to describe the system-to-system interface protocols and practices that are available for use between LivePepper and its partners.
This document is for business analysts, system architects, system engineers, developers, and testing organizations that need to build or test systems that programmatically access the LivePepper system.
If you have an API problem for which you can’t find a solution in this guide, then please contact LivePepper Support for assistance using any of these methods:
A REST API provides a powerful, convenient, yet simple web services API for communication with the LivePepper system. It’s easy to integrate with most other systems, and it’s an excellent technology for use with Web 2.0 projects.
To use this document, you should have a basic understanding of software development, web services, and online/remote order processing. In this guide, we show you:
A REST resource provides an abstract for an element of information – such as a single data record, a collection of records, or dynamic real-time information. Each resource in the LivePepper REST API has a unique identity in the form of a specific URL, and you access a resource using standard HTTP methods (HEAD, GET, POST, PATCH, DELETE).
The HTTP method indicates the type of action performed on the data:
Action | HTTP Method | Description |
---|---|---|
Create | POST | Creates and persists a resource of the corresponding type. |
List | GET | Returns information for all resources matching query parameters you provide. To get comprehensive information for a particular resource, first get the resource’s id with the appropriate List endpoint, then provide the id to the corresponding Retrieve endpoint. |
Retrieve | GET | Provides comprehensive information for the single resource that matches the identifier you provide. |
Update | PUT | Modifies the existing resource that matches the identifier you provide. |
Delete | DELETE | Deletes the existing resource that matches the identifier you provide. Deleted resources cannot be retrieved or undeleted. |
By means of this API, you can perform a variety of functions—including checking and modifying order status, reviewing order details, and managing customer loyalty balances.
Some of the examples in this guide use the cURL utility to send HTTP requests for accessing, creating, and modifying LivePepper REST resources on the platform. cURL is available natively on many Linux and Mac systems. Microsoft Windows users download a version at curl.haxx.se/. When using HTTPS on Windows, you’ll need to ensure that your system meets the cURL requirements for SSL.
As an alternative to cURL, Windows users can install Postman as a browser plugin: https://www.getpostman.com/
LivePepper users can place orders on the website and engage freely with the API—using the following links and credentials. We will use the following items for illustrating the usage of the API.
Using the is Basic Authentication scheme, you need to authenticate before accessing LivePepper API resources. The form of the curl command is:
Taking the username, password and API link from the Example API section, you would enter the following curl command to authenticate into the API:
You can retrieve a list of available LivePepper API resources by submitting the following request:
The response includes all of the available API resources:
john-pizza
John Pizza
0102030405
Colorado Avenue
Denver
US
11111
30
20
15
0
Eastern Time (US & Canada)
USD
After your customer places an order on your website, you can retrieve the order through the web API function new_orders. You’ll need to include your store name in the call, as we show in this example:
The response will contain a link to one or more orders, such as the following:
In the example above, we see that order number 2293319 is in the queue. To retrieve the details for this order, you need to simply follow the link given in the response to the new_orders resource above. Of course, you need to perform a GET with the order URL immediately after you get the response from the new_orders resource.
An order will remain in the new order status until the order status changes. See the section to learn how to change the status of an order.
Is it important to note that an etag value will be returned within the response headers. Its value will need to be provided when updating the order.
Below we show the example response for this order, which contains the order details and also the list of order items.
1513/1
2015-03-30T15:41:02Z
false
false
21.20 USD
0.00 USD
0.00 USD
0.00 USD
2015-03-30T12:15:00
new_order
accepted
rejected
collection
on_delivery
new_order
Regina ham
8''
5-1
6.80 USD
2
13.60 USD
6.80 USD
Regina ham
8''
5-1
6.80 USD
1
7.60 USD
6.80 USD
The response for Order Details will also include a link to for buyer details. From the example response, we would follow this link:
Placing this into a GET:
The response will contain the buyer details:
joe@foocompany.com
$2a$07$btCpyhVE2GmXNFIH/M5qru4B5kAHDdGsDFoP5JPKQe5gdNwYrMHGi
Antoine
Monnier
0102030405
US
LivePepper
en-US
2015-03-30T15:40:52Z
false
false
U
10.0
America/New_York
2015-03-30T15:55:48Z
To update a resource, you simply send a PUT request to the resource URL—the request must contain the updated XML representation in the message body as well as an If-None-Match header with the value provided when you first performed the GET request (note that the double quotes surrounding the “etag_value” returned during the GET must be used within that header).
Typically you’ll accept an order by sending the “accepted” value in the message. Here we continue with our examples given above for order number 2293319:
accepted
To retrieve general information about the store through the API, use the store function (john-pizza) as follows:
This is the response that you will receive:
john-pizza
John Pizza
0102030405
Colorado Avenue
Denver
US
11111
30
20
15
0
Eastern Time (US & Canada)
USD
To update the loyalty balance for a buyer, send a PUT request to /store/buyers, including the new balance and an optional reason should be passed in the URL. In this example, the new balance is 10 and the reason given is “bonus”.
The response will return the updated representation of the buyer.
To retrieve the entire list of store product offerings, use the products function as follows:
You’ll receive a response listing similar to the one below. This list will contain individual products—each of which you can retrieve individually with a GET.
If you have setup some postal codes in your administrative website, you can retrieve the entire list of postal codes by accessing the postal_codes resource:
You’ll receive a response message similar to the one below. Then you need to follow each URL to retrieve the geographic data that corresponds to that postal code.
You can send query parameters to the orders resource to retrieve a filtered orders list.
To retrieve orders that match a specific POS code, access the orders resource as follows:
It will retrieve a list of orders, and you can follow the link for each order to get those details (as we explain in Order Details).
To retrieve a list of orders placed between 13th Feb 2014 10am and 13th Feb 2014 8pm (UTC times), you could perform this request:
To lookup a buyer with an email address, use the buyers resource as we show in the example below. If there is a match, the list will contain a link to a single buyer; otherwise the list will be empty.
Contact
LivePepper – HB3
1681 route des Dolines
06560 Sophia Antipolis
France
Monday-Friday, 8.30am-5.30pm
Contact
LivePepper – HB3
1681 route des Dolines
06560 Sophia Antipolis
France
Monday-Friday, 8.30am-5.30pm