Skip to content

Commit

Permalink
Code examples for products
Browse files Browse the repository at this point in the history
  • Loading branch information
turbo124 committed Jun 7, 2024
1 parent 9c12131 commit a9046ca
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions api-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10175,10 +10175,28 @@ paths:
tags:
- products
summary: "List products"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X GET 'https://invoicing.co/api/v1/products?filter=search&per_page=20&page=1&include=documents' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$products = $ninja->products->all([
'filter' => 'search',
'per_page' => 20,
'page' => 1,
'include' => 'documents'
]);
description: |
Lists products, search and filters allow fine grained lists to be generated.
Query parameters can be added to perform fine grained filtering of the products list, these are handled by the ProductFilters class
which defines the methods available
Lists products within your company.

You can search and filter the result set using query parameters. These can be chained together allowing fine grained lists to be generated.

operationId: getProducts
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
Expand Down Expand Up @@ -10250,6 +10268,25 @@ paths:
tags:
- products
summary: "Create Product"
x-code-samples:
- lang: curl
label: Curl
source: |
curl -X POST 'https://invoicing.co/api/v1/products' \
-H "X-API-TOKEN:company-token-test" \
-H "Content-Type:application/json" \
-d '{"product_key":"sku_1","notes":"product description","cost":1,"price":10}' \
-H "X-Requested-With: XMLHttpRequest";
- lang: go
label: PHP
source: |
$ninja = new InvoiceNinja("your_token");
$products = $ninja->products->create([
'product_key' => "sku_1",
'notes' => "product description",
'cost' => 1,
'price' => 10
]);
description: "Adds a product to a company"
operationId: storeProduct
parameters:
Expand Down

0 comments on commit a9046ca

Please sign in to comment.