Compare commits

..

10 Commits

Author SHA1 Message Date
RaggedStaff 4eae5ba45d Added state filters to bulk Orders.get. 2024-07-16 10:39:24 +01:00
RaggedStaff 2829c53f6e Fixed dfc-b:compares to use Offer, not SuppliedProduct 2024-07-12 08:43:18 +01:00
RaggedStaff d1c8bbb19a Added CatalogItem.POST 2024-07-11 15:33:01 +01:00
RaggedStaff 663207140c Adjusted INRAE-graph example to use direct soldBy property, instead of going through SaleSession > Coordination. 2024-07-09 13:08:16 +01:00
RaggedStaff f6d2142a6e Added '#' for Null Id's in post requests. 2024-07-09 12:27:05 +01:00
RaggedStaff 0b15d2ab41 Added various @graph examples 2024-07-09 12:10:04 +01:00
Garethe 330683998b Added Inrae endpoints (#4)
* Initial commit, not working

* First Attempt

* Added SuppliedProduct:Name, ProductType & SalesSession dates

* Added Distributor postcode & comments to clarify what data relates to.

* Added SuppliedProduct:hasQuantity & annotated various quantities in example.

* Push from SwaggerHub.

* API definition transferred by SwaggerHub

* Added city to address objects & comment to confirm Price relates to Order/Sale price, not Catalog Price

* Added versioned redirects for ontology & taxonomies repo's

* Added @graph example

* graph example update
2024-07-09 11:27:22 +01:00
RaggedStaff 36e77bdc1f Added cursor-based pagination example to CatalogItems.get 2024-07-09 10:07:20 +01:00
RaggedStaff 9872783b1e Updated example on SuppliedProducts.get to use Cursor-based pagination 2024-07-09 10:01:14 +01:00
RaggedStaff 508a6d3b53 Added PUT for Order, Order Line & SaleSession 2024-06-12 14:00:49 +01:00
3 changed files with 791 additions and 152 deletions
+195
View File
@@ -0,0 +1,195 @@
openapi: 3.0.0
info:
version: v0.1
title: DFC INRAE Endpoint
contact:
{
"name": "DFC General Contact" ,
"url": "https://www.datafoodconsortium.org/" ,
"email": "hello@datafoodconsortium.org"
}
description: >-
Endpoint to expose anonymous product sales data for research purposes. Must
be authenticated, must be anonymized. Served at Order Line leve for
granularity.
components:
securitySchemes:
oidc_token:
type: openIdConnect
openIdConnectUrl: https://login.lescommuns.org/auth/realm/datafoodconsortium
security:
- oidc_token: []
paths:
"/api/dfc/Persons/{id}/AffilateSalesData":
get:
summary: Returns anonymized order line data
description: Show anonymized sales data, for a given date range, for all Enterprises that have authorized this Person to collect their data.
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: page
description: The page number of items to start with (see limit)
in: query
required: true
schema:
type: integer
minimum: 1
default: 1
example: 1
- name: limit
description: The number of items to return
in: query
required: true
schema:
type: integer
format: int32
minimum: 1
maximum: 225
default: 25
example: 25
- name: startDate
description: The start date from which data is requested
in: query
required: true
schema:
type: string
default: "2024-01-01"
example: "2024-01-01"
- name: endDate
description: The end date to which data is requested
in: query
required: true
schema:
type: string
default: "2024-12-31"
example: "2024-12-31"
tags:
- INRAE
responses:
'200':
description: successful
content:
application/json:
examples:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@graph": [
{
"@id": http://test.host/api/dfc/Persons/1001/AffilateSalesData,
"@type": dfc-b:Person,
dfc-b:affiliates: http://test.host/api/dfc/Enterprises/10000
},
{
"@id": http://test.host/api/dfc/Enterprises/10000 , # Producer Enterprise
"@type": dfc-Enterprise,
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/Car-20170 ,
dfc-b:supplies: https://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
dfc-b-supplies: https://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10002
},
{
"@id": http://test.host/api/dfc/Enterprises/10023 , # 2nd Producer Enterprise
"@type": dfc-Enterprise,
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/Car-20170 ,
dfc-b:supplies: https://test.host/api/dfc/Enterprises/10023/SuppliedProducts/10231 ,
dfc-b-supplies: https://test.host/api/dfc/Enterprises/10023/SuppliedProducts/10232
},
{
"@id": http://test.host/api/dfc/Enterprises/10050 , # Distributor Enterprise
"@type": dfc-Enterprise,
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/Car-20173 ,
dfc-b:coordinates: https://test.host/api/dfc/Enterprises/10050/SaleSessions/10002 ,
},
{
"@id": http://test.host/api/dfc/Addresses/Car-20170 ,
"@type": dfc-b:Address ,
dfc-b:postcode: 20170 , # Producer Postcode
dfc-b:city: Carbini
},
{
"@id": http://test.host/api/dfc/Addresses/Car-20173 ,
"@type": dfc-b:Address ,
dfc-b:postcode: 20173 , # Shop/Distributor Postcode
dfc-b:city: Carbini
},
{
"@id": https://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
"@type": dfc-b:SuppliedProduct ,
dfc-b:Name: Basil Pesto 250g Jar ,
dfc-b:hasType: dfc-pt:processed-vegetable , # Not required
dfc-b:hasQuantity: { # the quantity related
"@type": dfc-b:QuantitativeValue , # to the Supplied
dfc-b:hasUnit: dfc-m:Gram , # Product (in this
dfc-b:value: 250.0 # case 250g)
},
dfc-b:suppliedBy: http://test.host/api/dfc/Enterprises/10000 ,
dfc-b:concernedBy: https://test.host/api/dfc/Enterprises/10000/Orders/10001/OrderLines/10001-01
},
{
"@id": https://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10002 ,
"@type": dfc-b:SuppliedProduct ,
dfc-b:Name: Tomatoes - Cour de Beouf ,
dfc-b:hasType: dfc-pt:Tomatoes , # Not required
dfc-b:hasQuantity: { # the quantity related
"@type": dfc-b:QuantitativeValue , # to the Supplied
dfc-b:hasUnit: dfc-m:Gram , # Product (in this
dfc-b:value: 500.0 # case 250g)
},
dfc-b:suppliedBy: http://test.host/api/dfc/Enterprises/10000 ,
dfc-b:concernedBy: https://test.host/api/dfc/Enterprises/10000/Orders/10001/OrderLines/10001-02
},
{
"@id": https://test.host/api/dfc/Enterprises/10000/Orders/10001/OrderLines/10001-01 ,
"@type": dfc-b:OrderLine ,
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
dfc-b:hasQuantity: {
"@type": dfc-b:QuantitativeValue , # the quantity related to
dfc-b:hasUnit: jar , # the actual Sale (in
dfc-b:hasValue: 3 # this case 3 jars, at 250g each)
},
dfc-b:Price: {
"@type": dfc-b:QuantitativeValue , # the price charged for the item
dfc-b:hasUnit: EUR , # before any discount
dfc-b:value: 19.95 ,
dfc-b:VATrate: 0.0
},
dfc-b:partOf: https://test.host/api/dfc/Enterprises/10000/Orders/10001
},
{
"@id": https://test.host/api/dfc/Enterprises/10000/Orders/10001/OrderLines/10001-02 ,
"@type": dfc-b:OrderLine ,
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10002 ,
dfc-b:hasQuantity: {
"@type": dfc-b:QuantitativeValue , # the quantity related to
dfc-b:hasUnit: Bag , # the actual Sale (in
dfc-b:hasValue: 2 # this case 3 jars, at 250g each)
},
dfc-b:Price: {
"@type": dfc-b:QuantitativeValue , # the price charged for the item
dfc-b:hasUnit: EUR , # before any discount
dfc-b:value: 12.50 ,
dfc-b:VATrate: 0.0
},
dfc-b:partOf: https://test.host/api/dfc/Enterprises/10000/Orders/10001
},
{
"@id": https://test.host/api/dfc/Enterprises/10000/Orders/10001 ,
"@type": dfc-b:Order ,
dfc-b:date: "2024-06-25" , # Order Date
dfc-b:soldBy: https://test.host/api/dfc/Enterprises/10050 ,
dfc-b:hasPart: https://test.host/api/dfc/Enterprises/10000/Orders/10001/OrderLines/10001-01 ,
dfc-b:hasPart: https://test.host/api/dfc/Enterprises/10000/Orders/10001/OrderLines/10001-02
}
]
'404':
description: not found
servers:
# Added by API Auto Mocking Plugin
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/RAGGEDSTAFF23/DFC-INRAE-Endpoint/v0.1
+128
View File
@@ -0,0 +1,128 @@
openapi: 3.0.0
info:
version: v0.1
title: DFC INRAE Endpoint
contact:
{
"name": "DFC General Contact" ,
"url": "https://www.datafoodconsortium.org/" ,
"email": "hello@datafoodconsortium.org"
}
description: >-
Endpoint to expose anonymous product sales data for research purposes. Must
be authenticated, must be anonymized. Served at Order Line leve for
granularity.
components:
securitySchemes:
oidc_token:
type: openIdConnect
openIdConnectUrl: https://login.lescommuns.org/auth/realm/datafoodconsortium
security:
- oidc_token: []
paths:
"/api/dfc/Persons/{id}/AffilateSalesData":
get:
summary: Returns anonymized order line data
description: Show anonymized sales data, for a given date range, for all Enterprises that have authorized this Person to collect their data.
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: page
description: The page number of items to start with (see limit)
in: query
required: true
schema:
type: integer
minimum: 1
default: 1
example: 1
- name: limit
description: The number of items to return
in: query
required: true
schema:
type: integer
format: int32
minimum: 1
maximum: 225
default: 25
example: 25
- name: startDate
description: The start date from which data is requested
in: query
required: true
schema:
type: string
default: "2024-01-01"
example: "2024-01-01"
- name: endDate
description: The end date to which data is requested
in: query
required: true
schema:
type: string
default: "2024-12-31"
example: "2024-12-31"
tags:
- INRAE
responses:
'200':
description: successful
content:
application/json:
examples:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Persons/1001/AffilateSalesData
"@type": dfc-b:Person
dfc-b:affiliates:
"@type": dfc-Enterprise
dfc-b:hasAddress:
"@type": dfc-b:Address
dfc-b:postcode: 20170 # Producer Postcode
dfc-b:city: Carbini
dfc-b:supplies:
"@type": dfc-b:SuppliedProduct
dfc-b:Name: Basil Pesto 250g Jar
dfc-b:hasType: dfc-pt:processed-vegetable # Not required
dfc-b:hasQuantity: # the quantity related
"@type": dfc-b:QuantitativeValue # to the Supplied
dfc-b:hasUnit: dfc-m:Gram # Product (in this
dfc-b:value: 250.0 # case 250g)
dfc-b:concernedBy:
"@type": dfc-b:OrderLine
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue # the quantity related to
dfc-b:hasUnit: jar # the actual Sale (in
dfc-b:hasValue: 3 # this case 3 jars, at 250g each)
dfc-b:Price:
"@type": dfc-b:QuantitativeValue # the price charged for the item
dfc-b:hasUnit: EUR # before any discount
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:partOf:
"@type": dfc-b:Order
dfc-b:date: "2024-06-25" # Order Date
dfc-b:belongsTo:
"@type": dfc-b:SaleSession
dfc-b:objectOf:
"@type": dfc-b:Coordination
dfc-b:coordinatedBy:
"@type": dfc-b:Enterprise
dfc-b:hasAddress:
"@type": dfc-b:Address
dfc-b:postcode: 20170 # Shop/Distrobutor Postcode
dfc-b:city: Carbini
'404':
description: not found
servers:
# Added by API Auto Mocking Plugin
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/RAGGEDSTAFF23/DFC-INRAE-Endpoint/v0.1
+468 -152
View File
@@ -65,24 +65,38 @@ paths:
get:
summary: List all CatalogItems for an Enterprise
parameters:
- name: page
description: The page number of items to start with (see limit)
- name: before
description: The cursor returned from a previous request, requesting the API return elements before that id.
in: query
required: true
required: false
schema:
type: integer
minimum: 1
default: 1
example: 1
- name: limit
description: The number of items to return
type: string
- name: after
description: The cursor returned from a previous request, requesting the API return elements after that id.
in: query
required: true
required: false
schema:
type: string
- name: first
description: Return up to the first x elements in the list
in: query
required: false
schema:
type: integer
format: int32
minimum: 1
maximum: 225
maximum: 255
default: 25
example: 25
- name: last
description: Return up to the last x elements in the list
in: query
required: false
schema:
type: integer
format: int32
minimum: 1
maximum: 255
default: 25
example: 25
tags:
@@ -154,6 +168,49 @@ paths:
dfc-b:stockLimitation: 0
'404':
description: not found
post:
summary: create a new CatalogItem for a given Enterprise
parameters: []
tags:
- CatalogItems
requestBody:
content:
application/json:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@graph": [
{
"@id": "#" ,
"@type": dfc-b:CatalogItem ,
dfc-b:references: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
dfc-b:sku: AR ,
dfc-b:stockLimitation: 0 ,
dfc-b:offeredThrough: {
"@id": "#1" ,
"@type": dfc-b:Offer ,
dfc-b:hasPrice: {
"@id": "#2" ,
"@type": dfc-b:Price ,
dfc-b:hasUnit: GBP ,
dfc-b:value: 4.95 ,
dfc-b:VATrate: 0.0
}
}
}
]
responses:
'201':
description: created
content:
application/json:
schema:
example:
"@id": http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001
'400':
description: bad request
'401':
description: unauthorized
put:
summary: Update CatalogItem
parameters: []
@@ -226,6 +283,7 @@ paths:
"@type": "@id"
dfc-b:stockLimitation: '3'
dfc-b:sku: new-sku
"/api/dfc/Enterprises/{enterprise_id}/customerCategories":
parameters:
- name: enterprise_id
@@ -261,6 +319,11 @@ paths:
responses:
'201':
description: created
content:
application/json:
schema:
example:
"@id": http://test.host/api/dfc/Enterprises/10000/customerCategories/10006
'400':
description: bad request
'401':
@@ -270,7 +333,8 @@ paths:
application/json:
schema:
example:
"@id": http://test.host/api/dfc/Enterprises/10000/customerCategories/10006
"@id": "#"
dfc-b:definedBy: http://test.host/api/dfc/Enterprises/10000
"/api/dfc/Enterprises/{enterprise_id}/customerCategories/{id}":
parameters:
@@ -307,6 +371,12 @@ paths:
parameters: []
tags:
- CustomerCategory
requestBody:
content:
application/json:
schema:
example:
"@id": http://test.host/api/dfc/Enterprises/10000/customerCategories/10006
responses:
'204':
description: no content
@@ -334,53 +404,65 @@ paths:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@graph":
- "@id": http://test.host/api/dfc/Enterprises/10000
"@type": dfc-b:Enterprise
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/40000
dfc-b:hasPhoneNumber: http://test.host/api/dfc/PhoneNumbers/444000200
dfc-b:email: hello@example.org
dfc-b:websitePage: https://test.host/
dfc-b:hasSocialMedia: http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook
dfc-b:name: Fred's Farm
dfc-b:hasDescription: This is an awesome enterprise
dfc-b:VATnumber: 123 456
dfc-b:manages: http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001
dfc-b:supplies: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:hasMainContact: http://test.host/api/dfc/Persons/10000
dfc-b:logo: http://test.host/active-storage/url/logo.png
dfc-b:affiliates: http://test.host/api/dfc/Enterprises/60000
- "@id": http://test.host/api/dfc/Addresses/40000
"@type": dfc-b:Address
dfc-b:hasStreet: 42 Doveton Street
dfc-b:hasPostalCode: '20170'
dfc-b:hasCity: Herndon
dfc-b:hasCountry: USA
dfc-b:region: Virginia
- "@id": http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
"@type": dfc-b:SuppliedProduct
dfc-b:name: Apple - 1g
dfc-b:description: Round
dfc-b:hasType: dfc-pt:non-local-vegetable
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: dfc-m:Gram
"@graph": [
{
"@id": http://test.host/api/dfc/Enterprises/10000 ,
"@type": dfc-b:Enterprise ,
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/40000 ,
dfc-b:hasPhoneNumber: http://test.host/api/dfc/PhoneNumbers/444000200 ,
dfc-b:email: hello@example.org ,
dfc-b:websitePage: https://test.host/ ,
dfc-b:hasSocialMedia: http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook ,
dfc-b:name: Fred's Farm ,
dfc-b:hasDescription: This is an awesome enterprise ,
dfc-b:VATnumber: 123 456 ,
dfc-b:manages: http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001 ,
dfc-b:supplies: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
dfc-b:hasMainContact: http://test.host/api/dfc/Persons/10000 ,
dfc-b:logo: http://test.host/active-storage/url/logo.png ,
dfc-b:affiliates: http://test.host/api/dfc/Enterprises/60000 ,
},
{
"@id": http://test.host/api/dfc/Addresses/40000 ,
"@type": dfc-b:Address ,
dfc-b:hasStreet: 42 Doveton Street ,
dfc-b:hasPostalCode: '20170' ,
dfc-b:hasCity: Herndon ,
dfc-b:hasCountry: USA ,
dfc-b:region: Virginia ,
},
{
"@id": http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
"@type": dfc-b:SuppliedProduct ,
dfc-b:name: Apple - 1g ,
dfc-b:description: Round ,
dfc-b:hasType: dfc-pt:non-local-vegetable ,
dfc-b:hasQuantity: {
"@type": dfc-b:QuantitativeValue ,
dfc-b:hasUnit: dfc-m:Gram ,
dfc-b:value: 1.0
dfc-b:alcoholPercentage: 0.0
dfc-b:lifetime: ''
dfc-b:usageOrStorageCondition: ''
dfc-b:totalTheoreticalStock: 0.0
},
dfc-b:alcoholPercentage: 0.0 ,
dfc-b:lifetime: '' ,
dfc-b:usageOrStorageCondition: '' ,
dfc-b:totalTheoreticalStock: 0.0 ,
dfc-b:image: http://test.host/active-storage/url/logo-white.png
- "@id": http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001
"@type": dfc-b:CatalogItem
dfc-b:references: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:sku: APP
dfc-b:stockLimitation: 5
},
{
"@id": http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001 ,
"@type": dfc-b:CatalogItem ,
dfc-b:references: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
dfc-b:sku: APP ,
dfc-b:stockLimitation: 5 ,
dfc-b:offeredThrough: http://test.host/api/dfc/Enterprises/10000/Offers/10001
- "@id": http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook
"@type": dfc-b:SocialMedia
dfc-b:name: facebook
},
{
"@id": http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook ,
"@type": dfc-b:SocialMedia ,
dfc-b:name: facebook ,
dfc-b:URL: https://facebook.com/user
}
]
'404':
description: not found
'post':
@@ -402,17 +484,18 @@ paths:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@id": "#"
"@type": dfc-b:Enterprise
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/40000
dfc-b:hasPhoneNumber: http://test.host/api/dfc/PhoneNumbers/444000200
dfc-b:email: hello@example.org
dfc-b:websitePage: https://test.host/
dfc-b:hasSocialMedia: http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook
dfc-b:hasSocialMedia: "#SocialMedias/facebook"
dfc-b:name: Fred's Farm
dfc-b:hasDescription: This is an awesome enterprise
dfc-b:VATnumber: 123 456
dfc-b:manages: http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001
dfc-b:supplies: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:manages: "#/CatalogItems/10001"
dfc-b:supplies: "#/SuppliedProducts/10001"
dfc-b:hasMainContact: http://test.host/api/dfc/Persons/10000
dfc-b:logo: http://test.host/active-storage/url/logo.png
dfc-b:affiliates: http://test.host/api/dfc/Enterprises/60000
@@ -666,24 +749,38 @@ paths:
get:
summary: List SuppliedProducts for an Enterprise
parameters:
- name: page
description: The page number of items to start with (see limit)
- name: before
description: The cursor returned from a previous request, requesting the API return elements before that id.
in: query
required: true
required: false
schema:
type: integer
minimum: 1
default: 1
example: 1
- name: limit
description: The number of items to return
type: string
- name: after
description: The cursor returned from a previous request, requesting the API return elements after that id.
in: query
required: true
required: false
schema:
type: string
- name: first
description: Return up to the first x elements in the list
in: query
required: false
schema:
type: integer
format: int32
minimum: 1
maximum: 225
maximum: 255
default: 25
example: 25
- name: last
description: Return up to the last x elements in the list
in: query
required: false
schema:
type: integer
format: int32
minimum: 1
maximum: 255
default: 25
example: 25
tags:
@@ -782,7 +879,7 @@ paths:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/6201/SuppliedProducts/0
"@id": "#"
"@type": dfc-b:SuppliedProduct
dfc-b:name: Apple
dfc-b:description: A delicious heritage apple
@@ -939,6 +1036,73 @@ paths:
type: string
get:
summary: Show all Orders for an Enterprise
parameters:
- name: before
description: The cursor returned from a previous request, requesting the API return elements before that id.
in: query
required: false
schema:
type: string
- name: after
description: The cursor returned from a previous request, requesting the API return elements after that id.
in: query
required: false
schema:
type: string
- name: first
description: Return up to the first x elements in the list
in: query
required: false
schema:
type: integer
format: int32
minimum: 1
maximum: 255
default: 25
example: 25
- name: last
description: Return up to the last x elements in the list
in: query
required: false
schema:
type: integer
format: int32
minimum: 1
maximum: 255
default: 25
example: 25
- name: orderState
description: fitler on an Order State
in: query
required: false
schema:
type: string
enum:
- Draft
- Held
- Complete
- Cancelled
- name: fulfilmentState
description: fitler on an Order's Fulfilment State
in: query
required: false
schema:
type: string
enum:
- Held
- Unfulfilled
- Fulfilled
- Cancelled
- name: paymentState
description: fitler on an Order's Payment State
in: query
required: false
schema:
type: string
enum:
- Unpaid
- Paid
- Cancelled
tags:
- Orders
responses:
@@ -950,51 +1114,120 @@ paths:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001
"@type": dfc-b:Order
dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
dfc-b:orderNumber: "MYORDERNUM:12345"
dfc-b:hasOrderStatus: dfc-v:Draft
dfc-b:hasFulfilmentStatus: dfc-v:Held
dfc-b:hasPaymentState: dfc-v:Unpaid
dfc-b:hasPaymentMethod:
"@type": dfc-b:PaymentMethod
dfc-b:paymentMethodType: Example Card PaymentMethod
dfc-b:paymentMethodProvider: Stripe
dfc-b:hasPrice:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: £0.27
dfc-b:VATrate: 0.00
dfc-b:discount: 1.55
dfc-b:OrderedBy: http://test.host/api/dfc/Persons/10000
dfc-b:selects:
"@type": dfc-b:ShippingOption
dfc-b:optionOf: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
dfc-b:fee: 1.50
dfc-b:uses:
"@type": dfc-b:PickupOption
dfc-b:pickedUpAt: Our Fantastic Farm Gate
dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10000
dfc-b:hasPart:
- "@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: Packet
dfc-b:hasValue: 5.0
dfc-b:Price:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:discount: []
"@graph": [
{
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001 ,
"@type": dfc-b:Order ,
dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002,
dfc-b:orderNumber: "MYORDERNUM:12345" ,
dfc-b:hasOrderStatus: dfc-v:Draft ,
dfc-b:hasFulfilmentStatus: dfc-v:Held ,
dfc-b:hasPaymentState: dfc-v:Unpaid ,
dfc-b:hasPaymentMethod: {
"@type": dfc-b:PaymentMethod ,
dfc-b:paymentMethodType: Example Card PaymentMethod ,
dfc-b:paymentMethodProvider: Stripe ,
dfc-b:hasPrice: {
"@type": dfc-b:QuantitativeValue ,
dfc-b:hasUnit: GBP ,
dfc-b:value: £0.27 ,
dfc-b:VATrate: 0.00
},
},
dfc-b:discount: 1.55 ,
dfc-b:OrderedBy: http://test.host/api/dfc/Persons/10000 ,
dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10050 ,
dfc-b:selects: {
"@type": dfc-b:ShippingOption ,
dfc-b:optionOf: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002 ,
dfc-b:fee: 1.50 ,
},
dfc-b:uses: {
"@type": dfc-b:PickupOption ,
dfc-b:pickedUpAt: Our Fantastic Farm Gate
},
dfc-b:hasPart: {
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01 ,
"@type": dfc-b:OrderLine ,
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001 ,
dfc-b:hasQuantity: {
"@type": dfc-b:QuantitativeValue ,
dfc-b:hasUnit: Packet ,
dfc-b:hasValue: 5.0
},
dfc-b:Price: {
"@type": dfc-b:QuantitativeValue ,
dfc-b:hasUnit: GBP ,
dfc-b:value: 19.95 ,
dfc-b:VATrate: 0.0 ,
},
dfc-b:discount: []
}
}
]
post:
summary: Create an Order
parameters: []
tags:
- Orders
requestBody:
content:
application/json:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@graph": [
{
"@id": "#" ,
"@type": dfc-b:Order ,
dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002,
dfc-b:orderNumber: "MYORDERNUM:12345" ,
dfc-b:hasOrderStatus: dfc-v:Draft ,
dfc-b:hasFulfilmentStatus: dfc-v:Held ,
dfc-b:hasPaymentState: dfc-v:Unpaid ,
dfc-b:hasPaymentMethod: {
"@type": dfc-b:PaymentMethod ,
dfc-b:paymentMethodType: Example Card PaymentMethod ,
dfc-b:paymentMethodProvider: Stripe ,
dfc-b:hasPrice: {
"@type": dfc-b:QuantitativeValue ,
dfc-b:hasUnit: GBP ,
dfc-b:value: £0.27 ,
dfc-b:VATrate: 0.00
},
},
dfc-b:discount: 1.55 ,
dfc-b:OrderedBy: http://test.host/api/dfc/Persons/10000 ,
dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10050 ,
dfc-b:selects: {
"@type": dfc-b:ShippingOption ,
dfc-b:optionOf: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002 ,
dfc-b:fee: 1.50 ,
},
dfc-b:uses: {
"@type": dfc-b:PickupOption ,
dfc-b:pickedUpAt: Our Fantastic Farm Gate
},
dfc-b:hasPart: {
"@id": "#/orderlines/10001-01" ,
"@type": dfc-b:OrderLine ,
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001 ,
dfc-b:hasQuantity: {
"@type": dfc-b:QuantitativeValue ,
dfc-b:hasUnit: Packet ,
dfc-b:hasValue: 5.0
},
dfc-b:Price: {
"@type": dfc-b:QuantitativeValue ,
dfc-b:hasUnit: GBP ,
dfc-b:value: 19.95 ,
dfc-b:VATrate: 0.0 ,
},
dfc-b:discount: []
}
}
]
responses:
'400':
description: bad request
@@ -1033,39 +1266,6 @@ paths:
dfc-b:pickedUpAt: Our Fantastic Farm Gate
dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10000
dfc-b:hasPart: http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
requestBody:
content:
application/json:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001
"@type": dfc-b:Order
dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
dfc-b:orderNumber: "MYORDERNUM:12345"
dfc-b:hasOrderStatus: dfc-v:Draft
dfc-b:hasFulfilmentStatus: dfc-v:Held
dfc-b:hasPaymentState: dfc-v:Unpaid
dfc-b:hasPaymentMethod:
"@type": dfc-b:PaymentMethod
dfc-b:paymentMethodType: Example Card PaymentMethod
dfc-b:paymentMethodProvider: Stripe
dfc-b:hasPrice:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: £0.27
dfc-b:VATrate: 0.00
dfc-b:discount: 1.55
dfc-b:OrderedBy: http://test.host/api/dfc/Persons/10000
dfc-b:selects:
"@type": dfc-b:ShippingOption
dfc-b:optionOf: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
dfc-b:fee: 1.50
dfc-b:uses:
"@type": dfc-b:PickupOption
dfc-b:pickedUpAt: Our Fantastic Farm Gate
dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10000
dfc-b:hasPart: http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"/api/dfc/Enterprises/{enterprise_id}/Orders/{id}":
parameters:
@@ -1080,7 +1280,7 @@ paths:
schema:
type: string
get:
summary: Show an Order
summary: Show a single Order
tags:
- Orders
responses:
@@ -1121,7 +1321,7 @@ paths:
dfc-b:hasPart:
- "@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: Packet
@@ -1134,7 +1334,61 @@ paths:
dfc-b:discount: []
'404':
description: not found
put:
summary: Update a single Order
tags:
- Orders
responses:
'401':
description: unauthorized
'204':
description: success
requestBody:
content:
application/json:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001
"@type": dfc-b:Order
dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
dfc-b:orderNumber: "MYORDERNUM:12345"
dfc-b:hasOrderStatus: dfc-v:Complete
dfc-b:hasFulfilmentStatus: dfc-v:Held
dfc-b:hasPaymentState: dfc-v:Unpaid
dfc-b:hasPaymentMethod:
"@type": dfc-b:PaymentMethod
dfc-b:paymentMethodType: Example Card PaymentMethod
dfc-b:paymentMethodProvider: Stripe
dfc-b:hasPrice:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: £0.25
dfc-b:VATrate: 0.00
dfc-b:discount: 1.25
dfc-b:OrderedBy: http://test.host/api/dfc/Persons/10000
dfc-b:selects:
"@type": dfc-b:ShippingOption
dfc-b:optionOf: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
dfc-b:fee: 1.50
dfc-b:uses:
"@type": dfc-b:PickupOption
dfc-b:pickedUpAt: Our Fantastic Farm Gate
dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10000
dfc-b:hasPart:
- "@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: Packet
dfc-b:hasValue: 4.0
dfc-b:Price:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:discount: []
"/api/dfc/Enterprises/{enterprise_id}/Orders/{order_id}/orderlines":
parameters:
@@ -1163,7 +1417,7 @@ paths:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001
dfc-b:partOf: http://test.host/api/dfc/Enterprises/10000/Orders/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
@@ -1195,7 +1449,7 @@ paths:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001
dfc-b:partOf: http://test.host/api/dfc/Enterprises/10000/Orders/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
@@ -1213,9 +1467,9 @@ paths:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"@id": "#"
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001
dfc-b:partOf: http://test.host/api/dfc/Enterprises/10000/Orders/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
@@ -1260,7 +1514,7 @@ paths:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001
dfc-b:partOf: http://test.host/api/dfc/Enterprises/10000/Orders/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
@@ -1274,6 +1528,36 @@ paths:
dfc-b:discount: 2.95
'404':
description: not found
put:
summary: Update a single Order Line
tags:
- OrderLines
responses:
'401':
description: unauthorized
'204':
description: success
requestBody:
content:
application/json:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/Offers/10001
dfc-b:partOf: http://test.host/api/dfc/Enterprises/10000/Orders/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: Packet
dfc-b:hasValue: 5.0
dfc-b:Price:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:discount: 2.95
"/api/dfc/Enterprises/{enterprise_id}/SaleSessions":
parameters:
@@ -1351,7 +1635,7 @@ paths:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
"@id": "#"
"@type": dfc-b:SaleSession
dfc-b:startDate: "2024-03-14T01:00:00+01:00"
dfc-b:endDate: "2024-03-21T00:59:59+01:00"
@@ -1412,6 +1696,38 @@ paths:
dfc-b:marginPercent: 5.0
'404':
description: not found
put:
summary: Update a sinlge Sales Session
tags:
- SaleSessions
responses:
'401':
description: unauthorized
'204':
description: success
requestBody:
content:
application/json:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
"@type": dfc-b:SaleSession
dfc-b:startDate: "2024-03-14T01:00:00+01:00"
dfc-b:endDate: "2024-03-18T08:47:15+01:00"
dfc-b:hasOption:
"@type": dfc-b:ShippingOption
"@id": http://test.host/api/dfc/Enterprises/10000/ShippingOptions/004
dfc-b:fee: 1.50
dfc-b:hostedAt:
"@type": dfc-b:VirtualPlace
dfc-b:URL: http:/test.host/store/FredsFarm/
dfc-b:lists: http://test.host/api/dfc/Enterprises/10000/Offers/10001
dfc-b:objectOf:
"@type": dfc-b:Coordination
dfc-b:coordinatedBy: http://test.host/api/dfc/Enterprises/10000
dfc-b:marginPercent: 5.0
servers: