Add/Update Item


The following endpoint can be used to add or update an item within the {app.name} application.


Endpoint

The following endpoint can be used to add or update an item. You must replace the site_id variable with the site id that was provided when the site was created.

POST
{base_url}/api/v4/site/{site_id}/item/addUpdate
Request
Field
Type
Required
Description
_id
String
The id of the item. This field is auto generated by the system and is not required when creating a new item, but it is required when updating an existing item.
name
String
The name of the item.
description
String
The description of the item.
unit_price
Number
The price per unit of the item. Format = 0.00
active
Boolean
--
This flag represents whether the item record is active and available to be used or not.
Default = `true`
Sample Request
			
				{
  "_id": "6839e415564d3cc2160d945e",
  "name": "Men's Large T-Shirt",
  "unit_price": 14.99,
  "active": true
}
			
		
Response
Field
Type
Description
success
Boolean
Whether the record was added or updated successfully.
action
String
Informs whether the record was added or updated. Will only be returned if `success` is `true`.
One of `added`, `updated`
_id
String
The auto generated id assigned to the record.
errors
String [ ]
A list of errors. Will only be returned if `success` is `false`.
Sample Response (Successful)
			
				{
  "success": true,
  "action": "added",
  "_id": "60f720d248f143332af022e0"
}
			
		
Sample Response (Failed)
			
				{
  "success": false,
  "errors": [
    "invalid field2",
    "missing field_name"
  ]
}