4.0 Stock order
This is the reference documentation for the Stock order endpoints.
Note
You can generate an example call for each endpoint using the Try It Out button.
This call will not trigger any action on your account unless you add your authentication token to it.
openapi: 3.0.0
info:
title: Stock order
description: |-
Order stock and view your company's order history.<p>You can use these endpoints to place orders and retrieve:<ul>
<li>Your company's order history</li>
<li>The details of a specific order</li>
<li>A list of operators your company can order stock from</li>
<li>A list of the type of stock your company can order from each operator</li>
<li>A spreadsheet listing every subscriber included in a specific order</li>
</ul>
version: 4.0.0
servers:
- url: 'https://api.iot-x.com'
paths:
/stock-orders:
get:
summary: Retrieves your company's order history.
description: 'The results include each order''s:<ul><li>Unique ID</li><li>Recipient name and address</li><li>Item total</li><li>Operator</li><li>Date and time at which the order was placed</li><li>Delivery method</li><li>Tracking number</li><li>Unique ID of the user who placed the order</li><li>Status</li></ul><p>To use this endpoint, your user account must have the <strong>View Stock Order History</strong> permission enabled.</p>'
tags:
- Stock orders
responses:
'200':
description: Success - returns the company's order history.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/StockOrders'
post:
summary: Creates a stock order.
tags:
- Stock orders
operationId: create-api-key
description: |
In the request body, you must provide the:<ul><li>Recipient's name</li><li>Recipient's address</li><li>Operator to order from</li><li>Type of stock to order</li><li>Amount of stock to order</li></ul><p>A successful request places the order and returns its <em>orderId</em>.<p><br>To use this endpoint, your user account must have the <strong>Order New Stock</strong> permission enabled.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateStockOrder'
required: true
responses:
'200':
description: Success - returns the order's ID.
content:
application/json:
schema:
type: object
properties:
orderId:
type: string
pattern: '[0-9]+'
example: 124755-29C7C77D1D
description: The order's unique identifier.
'400':
description: Error - invalid request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'/stock-orders/{orderId}':
get:
summary: Retrieves the details of a specific order.
description: 'This endpoint returns information about a specific order. The results include the order''s:<ul><li>Unique ID</li><li>Recipient name and address</li><li>Item total</li><li>Operator</li><li>Date and time at which the order was placed</li><li>Delivery method</li><li>Tracking number</li><li>Unique ID of the user who placed the order</li></ul><p>You must provide the <em>orderId</em> as a parameter in the request. This is the unique order identifier. This value is returned by the GET/available-operators endpoint.<p><br> To use this endpoint, your user account must have the <strong>View Stock Order History</strong> permission enabled.'
tags:
- Stock orders
parameters:
- name: orderId
in: path
description: The order's unique identifier.
required: true
schema:
type: string
responses:
'200':
description: Success - returns information about the specified order.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/StockOrders'
'404':
description: Error - resource not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'/stock-orders/{orderId}/subscribers/download':
get:
summary: Downloads a spreadsheet listing every subscriber in a specific order.
description: 'The spreadsheet returned by this endpoint is in XLSX format.<p><br>You must provide the <em>orderId</em> as a parameter in the request. This is the unique order identifier. This value is returned by the GET/available-operators endpoint.<p><p><br>To use this endpoint, your user account must have the <strong>View Stock Order History</strong> permission enabled.</p>'
tags:
- Stock orders
parameters:
- name: orderId
in: path
description: The order's unique identifier.
required: true
schema:
type: string
responses:
'200':
description: Success - returns a spreadsheet in XLSX format.
'404':
description: Error - resource not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/available-operators:
get:
summary: Retrieves a list of available stock types for each operator.
description: 'This endpoint returns a list containing:<ul><li>The operators your company can order stock from</li><li>The type of stock your company can order from each operator</li></ul></p><p> To use this endpoint, your user account must have the <strong>Order New Stock</strong> permission enabled.'
tags:
- Available operators
responses:
'200':
description: Success - returns a list of operators and stock types.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AvailableOperators'
components:
schemas:
StockOrders:
type: object
properties:
orderId:
type: string
pattern: '[0-9]+'
description: The order's unique identifier.
example: 124755-29C7C77D1D
name:
type: string
minLength: 0
maxLength: 255
description: The recipient's name.
example: Jane Doe
address:
type: string
minLength: 0
maxLength: 255
description: The recipient's postal address.
example: 'Apt 56B, Whitehaven Mansions, Sandhurst Square, London, SE15 5RS'
quantity:
type: integer
pattern: '[0-9]+'
description: The number of stock items in the order.
example: 200
network:
type: string
description: The operator's name.
example: Operator One
dateCreated:
type: string
format: date-time
description: The date and time at which the order was placed.
example: '2018-09-13 15:05:54'
method:
type: string
description: The delivery method.
example: UPS
trackingNumber:
type: string
description: The tracking number
example: F113610A7UK
userRequestedId:
type: integer
pattern: '[0-9]+'
description: The unique identifier of the user who placed the order.
example: 14
status:
type: string
description: The status of the order.
example: Complete
CreateStockOrder:
type: object
properties:
recipientName:
minLength: 0
maxLength: 255
type: string
description: The recipient's name.
example: Jane Doe
recipientAddress:
minLength: 0
maxLength: 255
type: string
description: The recipient's postal address.
example: 'Apt 56B, Whitehaven Mansions, Sandhurst Square, London, SE15 5RS'
operatorName:
type: string
description: The operator's name.
example: Operator One
simTypeId:
type: integer
pattern: '[0-9]+'
description: The stock type's identifier.
example: '99'
quantity:
type: integer
pattern: '[0-9]+'
description: The number of stock items in the order.
example: 200
AvailableOperators:
type: object
properties:
operatorId:
type: string
description: The operator's unique identifier.
example: '412'
operatorName:
type: string
description: The operator's name.
example: Operator One
simTypes:
type: array
items:
properties:
id:
type: integer
pattern: '[0-9]+'
description: The stock type's identifier.
example: '99'
operator:
type: string
description: The operator's name.
example: Operator One
simType:
type: string
description: 'A description of the stock type, such as the SIM form factor.'
example: 2FF
ErrorResponse:
type: object
properties:
error:
type: object
properties:
message:
type: string
description: An error message describing what went wrong.