Customers
GET <qbench-url>/qbench/api/v1/customer/{customerId}
Will retrieve a customer by its ID
Example request:
GET /qbench/api/v1/customer/1 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Example response:
{
"address": null,
"comments": null,
"customer_name": "Example Customer",
"fax": null,
"id": 1,
"phone": null,
"tags": [
"Example tag"
]
}
GET <qbench-url>/qbench/api/v1/customer?page_num={pageNum}&page_size={pageSize}
Will retrieve a paginated list of customers. Maximum page size is 50.
Example request:
GET /qbench/api/v1/customer?page_num=1&page_size=50 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Example response:
{
"total_count": 75,
"total_pages": 2,
"data": [
{
"fax": null,
"tags": [
"Example tag"
],
"comments": null,
"phone": null,
"address": null,
"id": 1,
"customer_name": "Example Customer"
},
{
"fax": null,
"tags": [],
"comments": null,
"phone": null,
"address": null,
"id": 3,
"customer_name": "Example Customer 2"
},
...
]
}
POST <qbench-url>/qbench/api/v1/customer
Will create a new customer. Customer name is required. When creating a customer, you can also include a list of contacts. Each contact must already have been created in QBench and the contact ID must be included in each contact JSON body. You can optionally update any contact at this time by including additional contact fields in the JSON body.
Example request:
POST /qbench/api/v1/customer HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"customer_name": "Example Customer 3",
"contacts":[
{
"first_name":"John",
"last_name":"Doe",
"email_address":"example@example.com",
"id":1
},
{
"first_name":"Jane",
"last_name":"Doe",
"email_address":"example@example.com",
"id":2
}
]
}
Example response:
{"id":4}
PUT <qbench-url>/qbench/api/v1/customer/{customerId}
Will update an existing customer. Customer name cannot be null. When updating a customer, you can also include a list of contacts. Each contact must already have been created in QBench and the contact ID must be included in each contact JSON body. You can optionally update any contact at this time by including additional contact fields in the JSON body. Updating the contacts list will overwrite any previous contacts that were associated with the customer.
Example request:
PUT /qbench/api/v1/customer/1 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"phone":"(000) 000-0000",
"contacts":[
{
"first_name":"John",
"last_name":"Doe",
"email_address":"example@example.com",
"id":1
},
{
"first_name":"Jane",
"last_name":"Doe",
"email_address":"example@example.com",
"id":2
}
]
}
Example response:
{"message":"OK"}
DELETE <qbench-url>/qbench/api/v1/customer/{customerId}
Will delete a customer.
Example request:
DELETE /qbench/api/v1/customer/1 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Example response:
{"message":"OK"}
POST <qbench-url>/qbench/api/v1/customer/contacts/add
Will add contacts to a customer. The contacts field is structured so that the key is the contact ID and the payload in the contact can consist of 3 parameters
Example request:
POST /qbench/api/v1/customer/contacts/add HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"id”: 1,
“contacts”: {
1: {
“receive_email”: False,
“receive_invoice_email: False,
“portal_user”: True
},
2: {
“receive_email”: True,
“Portal_user”: False,
}
}
}
Example response:
{"message": OK}
POST <qbench-url>/qbench/api/v1/customer/contact/remove
Will remove a contact from a customer.
Example request:
POST /qbench/api/v1/customer/contacts/add HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"id”: 1,
“contact_id”: 1
}
Example response:
{"message": OK}
POST <qbench-url>/qbench/api/v1/customer/{customerId}/assays
Will CREATE new Customer-Assay discount items
Example request:
POST /qbench/api/v1/customer/123/assays HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"assay_discounts":
[
{"assay_id": 1, "base_price": 100, "discount": 20"},
{"assay_id": 2, "base_price": 30, "discount": 10}
]
}
Example response:
{"message": OK}
PATCH <qbench-url>/qbench/api/v1/customer/{customerId}/assays
Will UPDATE existing Customer-Assay discount items
Example request:
POST /qbench/api/v1/customer/123/assays HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"assay_discounts":
[
{"assay_id": 1, "base_price": 10, "discount": 5"},
{"assay_id": 2, "base_price": 20, "discount": 30}
]
}
Example response:
{"message": OK}
DELETE <qbench-url>/qbench/api/v1/customer/{customerId}/assays?assay_ids={assayId}
Will DELETE existing Customer-Assay discount items
Example request:
POST /qbench/api/v1/customer/123/assays?assay_ids=1&assay_ids=2 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
Example response:
{"message": OK}
POST <qbench-url>/qbench/api/v1/customer/{customerId}/panels
Will CREATE new Customer-Panel discount items
Example request:
POST /qbench/api/v1/customer/123/panels HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"panel_discounts":
[
{"panel_id": 1, "base_price": 100, "discount": 20"},
{"panel_id": 2, "base_price": 30, "discount": 10}
]
}
Example response:
{"message": OK}
PATCH <qbench-url>/qbench/api/v1/customer/{customerId}/panels
Will UPDATE existing Customer-Panel discount items
Example request:
POST /qbench/api/v1/customer/123/panels HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"panel_discounts":
[
{"panel_id": 1, "base_price": 10, "discount": 5"},
{"panel_id": 2, "base_price": 20, "discount": 30}
]
}
Example response:
{"message": OK}
DELETE <qbench-url>/qbench/api/v1/customer/{customerId}/panels?panel_ids={panelId}
Will DELETE existing Customer-Panel discount items
Example request:
POST /qbench/api/v1/customer/123/panels?panel_ids=1&panel_ids=2 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
Example response:
{"message": OK}
Comments
0 comments
Please sign in to leave a comment.