Blog

Traductions et Relations d’API

Les relations d'entités

Lors d’une requête GET sur une seule entité, dans la réponse vous aurez un lien URI de toutes les entités qui utilisent cette ressource. Ce lien utilise les filtres d’API pour générer une liste contenant seulement les entités désirées.

{
"entriesListing": "/api/v3/accounting_entries?account={{id}}"
}

Les relations suivent le standard PropertyNameListing pour se différencier des autres propriétés.

Les traductions

L’API fait la distinction entre les entités et leurs traductions. Chaque entité qui possède une traduction aura un lieu URI dans sa réponse qui permettra de faire la liste de toutes les traductions qui lui sont associée, comme les autres relations d’entités.

{
"translationsListing": "/api/v3/accounting_accounttranslations?translatable={{id}}"
}

curl https://xxx.phpreaction.com/platform/v3/products/4?access_token={{access_token}

{
"@context": "/api/v3/contexts/products",
"@id": "/api/v3/products/4",
"@type": "products",
"timestamp": "2018-02-12T15:09:55-05:00",
"sku": null,
"version": null,
"price": "0.00000",
"priceSpecial": "0.00000",
"visibleStatus": true,
"taxable": true,
"country": null,
"place": null,
"placePrecision": null,
"producible": true,
"newStatus": true,
"type": {
"@id": "/api/v3/product_types/1",
"@type": "product_types",
"id": 1,
"createdAt": "2000-01-01T00:00:00-05:00",
"updatedAt": "2000-01-01T00:00:00-05:00"
},
"brand": null,
"supplier": {
"@id": "/api/v3/person_suppliers/1",
"@type": "person_suppliers",
"id": 1,
"createdAt": "2000-01-01T00:00:00-05:00",
"updatedAt": "2000-01-01T00:00:00-05:00",
"toString": "Interne in"
},
"weight": "0.00000",
"dimensionW": "0.00",
"dimensionH": "0.00",
"dimensionD": "0.00",
"time": "0.00",
"cost": "0.00000",
"additionnalProductionCost": "0.00000",
"costSpecial": "0.00000",
"invQtyMin": "0.000",
"invQtyMax": "100.000",
"moq": "0.000",
"packageOrder": "0.000",
"inventoryTracking": true,
"rentTracking": false,
"countedInInventory": true,
"shippingTracking": false,
"notes": "",
"thumbnail": null,
"imageSmall1": null,
"imageSmall2": null,
"image": null,
"unitType": {
"@id": "/api/v3/product_unit_types/1",
"@type": "product_unit_types",
"id": 1,
"createdAt": "2000-01-01T00:00:00-05:00",
"updatedAt": "2000-01-01T00:00:00-05:00"
},
"unitNb": "1.000",
"supplierCode": null,
"clientCode": null,
"shCode": null,
"reservationPeriodicity": {
"@id": "/api/v3/periods/3",
"@type": "periods",
"id": 3,
"createdAt": "2000-01-01T00:00:00-05:00",
"updatedAt": "2000-01-01T00:00:00-05:00"
},
"periodicityPrecision": "0.000",
"bookable": true,
"discountable": true,
"salable": true,
"invoiceLineType": {
"@id": "/api/v3/invoice_line_types/3",
"@type": "invoice_line_types",
"id": 3,
"createdAt": "2000-01-01T00:00:00-05:00",
"updatedAt": "2000-01-01T00:00:00-05:00"
},
"purchasable": true,
"billLineType": {
"@id": "/api/v3/bill_line_types/8",
"@type": "bill_line_types",
"id": 8,
"createdAt": "2000-01-01T00:00:00-05:00",
"updatedAt": "2000-01-01T00:00:00-05:00"
},
"onDistribution": true,
"onWebsite": true,
"owningCorporation": null,
"isVariableExpense": true,
"isImmo": false,
"id": 4,
"createdAt": "2018-02-12T15:09:55-05:00",
"updatedAt": "2018-02-12T15:09:55-05:00",
"toString": "Produit de base A4",
"billLinesListing": "/api/v3/bill_lines?product=4",
"invoiceLinesListing": "/api/v3/invoice_lines?product=4",
"rentsListing": "/api/v3/rents?product=4",
"rentsChargedListing": "/api/v3/rents?chargedProduct=4",
"inventoryEntriesListing": "/api/v3/inventory_entries?product=4",
"applicableCost": "0.00000",
"name": "Produit de base",
"description": "

Produit de base

", "applicablePrice": "0.00000", "inStock": 50, "correction": 0, "productOptionsListing": "/api/v3/product_product_options?product=4", "subProductOptionsListing": "/api/v3/product_product_options?subProduct=4", "productComponentsListing": "/api/v3/product_product_components?product=4", "componentProductsListing": "/api/v3/product_product_components?component=4", "translationsListing": "/api/v3/product_producttranslations?translatable=4", "buyableBasePrice": "0.00000", "discount": "0.00" }

Related Posts