Sign in

    ot

    Read-only MoonBit client for the OrderTime inventory REST API: serial-number movement history, latest Ship Doc and Customer Return lookups, and inventory queries. Credentials are read from environment variables.

    ordertime
    inventory
    api-client
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    2 days ago
    Downloads
    29

    #Ordertime

    #Overview

    The Order Time REST API allows you to write code that can add, delete, modify and query almost selected records in Order Time.

    Before getting started with the API, your company's Master Admin must obtain an API key. All end points for the API are located at https://services.ordertime.com/api This is the origin URL used for your API Requests You add the endpoint to the end of the URL when doing your GET/POST/PUT, all endpoint documentation is found here Example - https://services.ordertime.com/api/partitem This RESTAPI is holistic. For PUT requests you should populate ALL applicable properties. It is recommended you first do a GET, store the result in a variable, make your changes then proceed to your PUT request.

    #API Request

    #Response Codes

    Code Description 200 OK - Request succeeded, For Delete request, the return value will be true otherwise the return value will be the requested object. 400 Bad request. An error message will be returned in the response. 403 Forbidden - The user does not have role rights to perform the given request. 409 Conflicted - The request was well formed however the data submitted failed the server's data validation tests. The response will include and array of ValidationResult objects. Only Code 400 will generate an error so you should always check the response code.

    What kind of tools can provide value to me using the ordertime API?

    #Querying data

    URL: https://services.ordertime.com/api/list Headers: apikey: email: password: Content-Type: application/json HTTP Method: PUT: returns the count of matching objects POST: returns the list of matching objects Payload: Fields: "Type" [required]: is a Number (RecordType enum) "Filters" [optional]: is a list of 0 or more objects "PropertyName" [required]: String field name of filter "FilterValueArray" [required]: String value of filter

    All filters must resolve to true When using the In or Not In operators, the FilterValueArray property should contain a comma delimited string of values When using the Custom DataMacro,the FilterValueArray property is required. For from date : "2018-02-01," For to date: ",2018-02-01" For between dates: "2018-01-01,2018-01-31"

    #Common workflows

    #Read-only

    • All transactions for a Serial Number
    • Latest Ship Doc for a Serial Number
    • Latest Customer Return for a Serial Number
    • Inventory for a Serial Number
    • All Inventory for a Model Number in a Location

    #Read-write (maybe later...)

    • Create a RMA for a given SN
    • Mark RMA as received
    • Process an RMA

    #Payloads to filter from the list endpoint

    #All transactions for a Serial Number

    { "Type": 1141, "Filters": [ { "PropertyName": "LotOrSerialNo", "FilterValueArray": "EXAMPLESN00000000001" } ] }

    Response: TranType DocNo

    #Latest Ship Doc for a Serial Number

    { "Type": 1141, "Filters": [ { "PropertyName": "LotOrSerialNo", "FilterValueArray": "EXAMPLESN00000000001" }, { "PropertyName": "TranType", "FilterValueArray": "4" } ] }

    Selection rule (client-side, latest_transaction in ordertime_client): the transaction with the highest DocNo. DocNo is the transaction sequence number, so the maximum is the most recently recorded one; the rule does not depend on response ordering.

    #Latest Customer Return for a Serial Number

    { "Type": 1141, "Filters": [ { "PropertyName": "LotOrSerialNo", "FilterValueArray": "EXAMPLESN00000000001" }, { "PropertyName": "TranType", "FilterValueArray": "10" } ] }

    Selection rule (client-side, latest_transaction in ordertime_client): the transaction with the highest DocNo. DocNo is the transaction sequence number, so the maximum is the most recently recorded one; the rule does not depend on response ordering.

    #Inventory of a serial number

    { "Type": 1141, "Filters": [ { "PropertyName": "LotOrSerialNo", "FilterValueArray": "EXAMPLESN00000000001" } ] }

    #All Inventory for a Model Number in a Location

    { "Type": 1110, "Filters": [ { "PropertyName": "LocationRef.Name", "FilterValueArray": "RMA Pending" }, { "PropertyName": "ItemRef.Name", "FilterValueArray": ".:ED-525B-WB" } ] }

    Response: LotOrSerialNo:

    #Details for Transaction

    { "Type": 1141, "Filters": [ { "PropertyName": "DocNo", "FilterValueArray": "51681" } ] }

    Tips:

    • put request returns the count of the matching results
    • post request return array of the result objects
    • can chain together multiple filters in payload

    #Relevant Enums

    #Type (Record types)

    Inventory: 1110 Inventory by Bin (incl. Serial Number): 1141

    #TranType (transaction types)

    Adjustment: 1 Receiver: 2 Ship Doc: 4 Transfer: 5 Purchase Order: 6 Sales Order: 7 Customer Return: 10

    #Redesigning my ordertime client logic

    right now I have

    types

    RecordType enum method to convert recordtype to double for the JSON payload

    Filter struct derives ToJson in format ordertime expects

    Transaction struct

    functions

    put in Serial Number as String and http client pub fn get_transactions_for_sn(@http.Client, String) -> Array[Transactions]

    put in RecordType and Filter to construct payload json (what to query for in ordertime) fn make_payload(RecordType, Array[Filter]) -> Json

    put in Response as json and parse for list of transactions fn parse_transactions(JSON) -> Array[Transaction]

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io