Skip to main content
Skip table of contents

What API do I use to create/update Purchaser?

API Endpoint: v1/api/integration/purchaser

Method: POST

Request Format: JSON structure

Example JSON structure:

  • Creating purchaser only with mandatory attributes:

    JSON
    [
      {
        "name": "Purchaser_1",
        "xid": "Purchaser_1_xid_10"
      }
    ]
  • Creating purchaser with purchaser source id:

    JSON
    [
      {
        "name": "Purchaser_2",
        "xid": "Purchaser_2_xid_20",
        "purchasersourceid": 5
      }
    ]

Mandatory Fields:

Attributes

Attribute Key

Constraints

Name

name

Required when creating a purchaser.

XID

xid

Required when creating a purchaser.

Required when updating purchaser if id not provided.

Id

id

When updating a record, either the id or xid must be provided.

Non-Mandatory Fields:

Attributes

Attribute Key

Constraints

Is Active

isactive

Default value: true

Is For Water

isforwater

Default value: false

Is For Oil

isforoil

Default value: true

Note: Details for other non-mandatory fields can be found in the Swagger documentation.

Response Format:

JSON
{
  "success": true,
  "message": "Some records were invalid, please correct and retry",
  "numProcessedItems": 1,
  "numUnProcessedItems": 1,
  "secondaryErrors": [],
  "output": {
    "processedItems": [
      {
        "record": {
          "name": "Purchaser_1",
          "purchasersourceid": 0,
          "createdby": 46498,
          "createdon": "2024-09-24T18:08:59.302Z",
          "modifiedby": 46498,
          "modifiedon": "2024-09-24T18:08:59.302Z",
          "xid": "Purchaser_1_xid_10",
          "code": null,
          "isactive": true,
          "isforwater": false,
          "isforoil": true,
          "tenantid": "9e873211-3a18-4b95-b9ad-32882c2ef508",
          "address": null,
          "city": null,
          "state": null,
          "zipcode": null,
          "phonenumber": null
        },
        "message": "record succesfully created"
      }
    ],
    "unProcessedItems": [
      {
        "record": {
          "name": "Purchaser_2"
        },
        "message": "SchemaError :  \"value\" must contain at least one of [id, xid]"
      }
    ]
  }
}

Common Reason for API failure:

What might be the issue

What is the resolution

If name is not provided while creating new record

Provide name for creating purchaser.

"value" must contain at least one of [id, xid]

Either the id or xid must be provided.

xid already exists for record

Unique xid should be provided.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.