Create a sales order line

POST /salesorders/{id}/lines

Add a new line to a specific sales order.

Headers

Path parameters

  • id integer(int32) Required

    The unique identifier for the sales order, to which the sales order lines pertain.

application/json

Body

A line item with its details in a sales order. The line item can be either a product or a text entry.

  • type string

    A specification for the type of the line item, whether this is a product or a text entry.

    Values are product or text.

  • product object

    Product details, if the line item type is 'product'. Note that the product object for the /salesorders/{id}/lines endpoint is not the same as the product that can be retrieved from the /products endpoint, even though both share the same ID reference and their schemas are similar. The product object in the context of /salesorders/{id}/lines contains the product details as they were at the time the sales order line item was created. In contrast, the /products endpoint always provides the latest state values for the product properties.

    Hide product attribute Show product attribute
    • id number

      A unique identifier for the product within 24SevenOffice ERP-modules.

  • A description for the line item.

    Minimum length is 1, maximum length is 300.

  • quantity number

    The quantity of the product in the line item.

  • price number

    The price of a single unit of the product in the line item.

  • The discount rate applied to the line item, expressed as a whole number. For example, a discount rate of 10% is represented as 10.

    Minimum value is 0, maximum value is 100.

  • tax object

    Details for the tax applied to the line item.

    Hide tax attributes Show tax attributes
    • id number

      A unique identifier for the tax code within 24SevenOffice ERP modules, associated with the line item.

    • number integer(int32)

      The tax code reference number visible for users.

    • rate number

      The tax rate percentage, expressed as a whole number. For example, a tax rate of 25% is represented as 25.

      Minimum value is 0, maximum value is 100.

  • account object

    Details for the account to which the sale is posted.

    Hide account attributes Show account attributes
    • id number

      A unique identifier for the account within 24SevenOffice accounting module.

    • number integer(int32)

      The unique number that indicates which type of account it belongs to.

    • name string

      The human-readable name that describes the purpose or nature of the account.

      Maximum length is 75.

Responses

  • 200 application/json

    OK

    Hide headers attributes Show headers attributes
    Hide response attributes Show response attributes object
    • id number

      The unique identifier for the sales order line item within 24SevenOffice ERP.

    • type string

      A specification for the type of the line item, whether this is a product or a text entry.

      Values are product or text.

    • product object

      Product details, if the line item type is 'product'. Note that the product object for the /salesorders/{id}/lines endpoint is not the same as the product that can be retrieved from the /products endpoint, even though both share the same ID reference and their schemas are similar. The product object in the context of /salesorders/{id}/lines contains the product details as they were at the time the sales order line item was created. In contrast, the /products endpoint always provides the latest state values for the product properties.

      Hide product attribute Show product attribute
      • id number

        A unique identifier for the product within 24SevenOffice ERP-modules.

    • A description for the line item.

      Minimum length is 1, maximum length is 300.

    • quantity number

      The quantity of the product in the line item.

    • price number

      The price of a single unit of the product in the line item.

    • The discount rate applied to the line item, expressed as a whole number. For example, a discount rate of 10% is represented as 10.

      Minimum value is 0, maximum value is 100.

    • tax object

      Details for the tax applied to the line item.

      Hide tax attributes Show tax attributes
      • id number

        A unique identifier for the tax code within 24SevenOffice ERP modules, associated with the line item.

      • number integer(int32)

        The tax code reference number visible for users.

      • rate number

        The tax rate percentage, expressed as a whole number. For example, a tax rate of 25% is represented as 25.

        Minimum value is 0, maximum value is 100.

    • account object

      Details for the account to which the sale is posted.

      Hide account attributes Show account attributes
      • id number

        A unique identifier for the account within 24SevenOffice accounting module.

      • number integer(int32)

        The unique number that indicates which type of account it belongs to.

      • name string

        The human-readable name that describes the purpose or nature of the account.

        Maximum length is 75.

  • 400 application/json

    Bad request

    Hide headers attributes Show headers attributes
    One of:
POST /salesorders/{id}/lines
curl \
 -X POST https://rest.api.24sevenoffice.com/v1/salesorders/{id}/lines \
 -H "Content-Type: application/json" \
 -H "Authorization: string" \
 -d '{"type":"product","product":{"id":101},"description":"Leather handbag with adjustable strap.","quantity":2,"price":49.99,"discountRate":10,"tax":{"id":1,"number":1,"rate":25},"account":{"id":200001,"number":1500,"name":"Accounts Receivable"}}'
Request examples
# Headers
Authorization: string

# Payload
{
  "type": "product",
  "product": {
    "id": 101
  },
  "description": "Leather handbag with adjustable strap.",
  "quantity": 2,
  "price": 49.99,
  "discountRate": 10,
  "tax": {
    "id": 1,
    "number": 1,
    "rate": 25
  },
  "account": {
    "id": 200001,
    "number": 1500,
    "name": "Accounts Receivable"
  }
}
Response examples (200)
# Headers
Access-Control-Allow-Origin: string
Access-Control-Allow-Credentials: string
X-Trace-Id: string

# Payload
{
  "id": 1,
  "type": "product",
  "product": {
    "id": 101
  },
  "description": "Leather handbag with adjustable strap.",
  "quantity": 2,
  "price": 49.99,
  "discountRate": 10,
  "tax": {
    "id": 1,
    "number": 1,
    "rate": 25
  },
  "account": {
    "id": 200001,
    "number": 1500,
    "name": "Accounts Receivable"
  }
}
Response examples (400)
# Headers
Access-Control-Allow-Origin: string
Access-Control-Allow-Credentials: string
X-Trace-Id: string

# Payload
{
  "error": {
    "name": "BadRequestError",
    "payload": {
      "errors": [
        {
          "type": "NoLines",
          "message": "No lines in the sales order",
          "arguments": [
            "lineItems"
          ]
        }
      ]
    }
  },
  "trackingId": "ghi789"
}
# Headers
Access-Control-Allow-Origin: string
Access-Control-Allow-Credentials: string
X-Trace-Id: string

# Payload
{
  "error": {
    "name": "ValidationError",
    "payload": {
      "validationErrors": [
        {
          "path": "customer.name",
          "keyword": "required"
        }
      ]
    }
  },
  "trackingId": "def456"
}