openapi: 3.2.0 info: version: 2.1.1 title: Metrilo tracking Order API description: Metrilo analytics tracking API contact: name: Metrilo email: support@metrilo.com url: https://www.metrilo.com servers: - url: https://trk.mtrl.me tags: - name: Order paths: /order: post: tags: - Order description: Adds a new order or updates an existing one in Metrilo. operationId: orderOperation requestBody: required: true content: text/plain: schema: $ref: '#/components/schemas/orderOperationObject' responses: '200': $ref: '#/components/responses/success' '400': $ref: '#/components/responses/errorBadRequest' '401': $ref: '#/components/responses/errorUnauthorized' '402': $ref: '#/components/responses/errorPaymentRequired' '403': $ref: '#/components/responses/errorForbidden' '500': $ref: '#/components/responses/internalServerError' '502': $ref: '#/components/responses/badGateway' summary: Order operation x-summary-source: derived /order/batch: post: tags: - Order description: Adds multiple orders or updates existing ones in Metrilo. operationId: orderBatchOperation requestBody: required: true content: text/plain: schema: $ref: '#/components/schemas/orderBatchOperationObject' responses: '200': $ref: '#/components/responses/success' '400': $ref: '#/components/responses/errorBadRequest' '401': $ref: '#/components/responses/errorUnauthorized' '402': $ref: '#/components/responses/errorPaymentRequired' '403': $ref: '#/components/responses/errorForbidden' '500': $ref: '#/components/responses/internalServerError' '502': $ref: '#/components/responses/badGateway' summary: Order batch operation x-summary-source: derived components: responses: errorBadRequest: description: Bad request from client. success: description: Success response. internalServerError: description: Error from server while processing request. badGateway: description: Error from server accepting request. errorUnauthorized: description: Project token is invalid. errorPaymentRequired: description: Project requires payment. errorForbidden: description: The IP that the request came from is ignored. schemas: orderBatchOperationObject: allOf: - $ref: '#/components/schemas/basicBackendObject' - required: - params properties: batch: type: array items: $ref: '#/components/schemas/orderObject' orderOperationObject: allOf: - $ref: '#/components/schemas/basicBackendObject' - required: - params properties: params: allOf: - $ref: '#/components/schemas/orderObject' basicBackendObject: type: object required: - time - token properties: time: type: integer description: Integer representation of the event time (milliseconds from 1970). example: 1518004715732 token: type: string description: Shop API token. example: ccc111ddddaaaaac platform: type: string description: Shop platform versioning. example: Wordpress 4.2.7 / Woocommerce 3.5 pluginVersion: type: string description: Metrilo plugin version. example: 1.1.0 orderObject: type: object required: - id - createdAt - amount - products - status properties: id: type: string description: Unique ID of the order in the shop's database. example: 14 createdAt: type: integer description: Integer representation of the time the order was created (milliseconds from 1970). example: 1518004715732 email: type: string description: Customer's email address. Used to link to an existing customer. example: johnybravo@metrilo.com amount: type: number description: Total amount of the order, including all shipping expenses, tax and the price of items. example: 308.42 coupons: type: array items: type: string description: Coupons applied to the order. Stored case insensitive. example: - EASTER15OFF status: type: string description: State of the order. example: completed products: type: array items: type: object required: - productId - quantity properties: productId: type: string description: The ID of the product in the shop's database. example: 91 quantity: type: number description: How many pieces of the product the visitor has added to the cart. example: 2 billing: type: object description: Order's billing information. properties: address: type: string description: Full billing address. example: 15 Somewhere Road, Brynmenyn city: type: string description: The exact city of the address. example: Bridgend countryCode: type: string description: Billing country 2-letter ISO code. example: CA phone: type: string description: Phone number to contact for further details about the order. example: 01559 032133 postcode: type: string description: Postcode for delivery and billing. example: NW1 4DF paymentMethod: type: string description: How the visitor will pay for the item(s), e.g. paypal, check, etc. example: PayPal ipAddress: type: string description: The IP address of the customer when they placed the order. example: 111.222.333.444