Add/Update Product


The following endpoint can be used to add or update a product within the Hyfin application. The products are then added to lines on an invoice.


Point de terminaison

The following endpoint can be used to add or update a product. You must replace the {base_url} and {site_id} variable with the site id that was provided when the site was created.

POST
{base_url}/api/v3.1/site/{site_id}/product/addUpdate

Demande
Champ
Type
Description
external_id
String
Le produit unique id du système/source de données. Si nous détectons un enregistrement avec le même external_id, il sera mis à jour, sinon il sera ajouté.
name
String
Le nom du produit.
description
String
La description du produit.
unit_price
Number
Le prix par unité du produit. Format = 0.00
active
Boolean
Ce drapeau représente si l'enregistrement du produit est actif et disponible pour être utilisé ou non.
Default = true
Sample Request
			
{
  "external_id": "39772641",
  "name": "Men's Large T-Shirt",
  "unit_price": 14.99,
  "active": true
}


		
Réponse
Champ
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"
  ]
}