Added various @graph examples

This commit is contained in:
RaggedStaff
2024-07-09 12:10:04 +01:00
parent 330683998b
commit 0b15d2ab41
+211 -118
View File
@@ -276,6 +276,11 @@ paths:
responses: responses:
'201': '201':
description: created description: created
content:
application/json:
schema:
example:
"@id": http://test.host/api/dfc/Enterprises/10000/customerCategories/10006
'400': '400':
description: bad request description: bad request
'401': '401':
@@ -285,7 +290,7 @@ paths:
application/json: application/json:
schema: schema:
example: example:
"@id": http://test.host/api/dfc/Enterprises/10000/customerCategories/10006 dfc-b:definedBy: http://test.host/api/dfc/Enterprises/10000
"/api/dfc/Enterprises/{enterprise_id}/customerCategories/{id}": "/api/dfc/Enterprises/{enterprise_id}/customerCategories/{id}":
parameters: parameters:
@@ -322,6 +327,12 @@ paths:
parameters: [] parameters: []
tags: tags:
- CustomerCategory - CustomerCategory
requestBody:
content:
application/json:
schema:
example:
"@id": http://test.host/api/dfc/Enterprises/10000/customerCategories/10006
responses: responses:
'204': '204':
description: no content description: no content
@@ -349,53 +360,65 @@ paths:
test_example: test_example:
value: value:
"@context": https://www.datafoodconsortium.org "@context": https://www.datafoodconsortium.org
"@graph": "@graph": [
- "@id": http://test.host/api/dfc/Enterprises/10000 {
"@type": dfc-b:Enterprise "@id": http://test.host/api/dfc/Enterprises/10000 ,
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/40000 "@type": dfc-b:Enterprise ,
dfc-b:hasPhoneNumber: http://test.host/api/dfc/PhoneNumbers/444000200 dfc-b:hasAddress: http://test.host/api/dfc/Addresses/40000 ,
dfc-b:email: hello@example.org dfc-b:hasPhoneNumber: http://test.host/api/dfc/PhoneNumbers/444000200 ,
dfc-b:websitePage: https://test.host/ dfc-b:email: hello@example.org ,
dfc-b:hasSocialMedia: http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook dfc-b:websitePage: https://test.host/ ,
dfc-b:name: Fred's Farm dfc-b:hasSocialMedia: http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook ,
dfc-b:hasDescription: This is an awesome enterprise dfc-b:name: Fred's Farm ,
dfc-b:VATnumber: 123 456 dfc-b:hasDescription: This is an awesome enterprise ,
dfc-b:manages: http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001 dfc-b:VATnumber: 123 456 ,
dfc-b:supplies: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 dfc-b:manages: http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001 ,
dfc-b:hasMainContact: http://test.host/api/dfc/Persons/10000 dfc-b:supplies: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
dfc-b:logo: http://test.host/active-storage/url/logo.png dfc-b:hasMainContact: http://test.host/api/dfc/Persons/10000 ,
dfc-b:affiliates: http://test.host/api/dfc/Enterprises/60000 dfc-b:logo: http://test.host/active-storage/url/logo.png ,
- "@id": http://test.host/api/dfc/Addresses/40000 dfc-b:affiliates: http://test.host/api/dfc/Enterprises/60000 ,
"@type": dfc-b:Address },
dfc-b:hasStreet: 42 Doveton Street {
dfc-b:hasPostalCode: '20170' "@id": http://test.host/api/dfc/Addresses/40000 ,
dfc-b:hasCity: Herndon "@type": dfc-b:Address ,
dfc-b:hasCountry: USA dfc-b:hasStreet: 42 Doveton Street ,
dfc-b:region: Virginia dfc-b:hasPostalCode: '20170' ,
- "@id": http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 dfc-b:hasCity: Herndon ,
"@type": dfc-b:SuppliedProduct dfc-b:hasCountry: USA ,
dfc-b:name: Apple - 1g dfc-b:region: Virginia ,
dfc-b:description: Round },
dfc-b:hasType: dfc-pt:non-local-vegetable {
dfc-b:hasQuantity: "@id": http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
"@type": dfc-b:QuantitativeValue "@type": dfc-b:SuppliedProduct ,
dfc-b:hasUnit: dfc-m:Gram 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:value: 1.0
dfc-b:alcoholPercentage: 0.0 },
dfc-b:lifetime: '' dfc-b:alcoholPercentage: 0.0 ,
dfc-b:usageOrStorageCondition: '' dfc-b:lifetime: '' ,
dfc-b:totalTheoreticalStock: 0.0 dfc-b:usageOrStorageCondition: '' ,
dfc-b:totalTheoreticalStock: 0.0 ,
dfc-b:image: http://test.host/active-storage/url/logo-white.png 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 "@id": http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001 ,
dfc-b:sku: APP "@type": dfc-b:CatalogItem ,
dfc-b:stockLimitation: 5 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 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 dfc-b:URL: https://facebook.com/user
}
]
'404': '404':
description: not found description: not found
'post': 'post':
@@ -968,6 +991,41 @@ paths:
type: string type: string
get: get:
summary: Show all Orders for an Enterprise 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
tags: tags:
- Orders - Orders
responses: responses:
@@ -979,51 +1037,120 @@ paths:
test_example: test_example:
value: value:
"@context": https://www.datafoodconsortium.org "@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001 "@graph": [
"@type": dfc-b:Order {
dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002 "@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001 ,
dfc-b:orderNumber: "MYORDERNUM:12345" "@type": dfc-b:Order ,
dfc-b:hasOrderStatus: dfc-v:Draft dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002,
dfc-b:hasFulfilmentStatus: dfc-v:Held dfc-b:orderNumber: "MYORDERNUM:12345" ,
dfc-b:hasPaymentState: dfc-v:Unpaid dfc-b:hasOrderStatus: dfc-v:Draft ,
dfc-b:hasPaymentMethod: dfc-b:hasFulfilmentStatus: dfc-v:Held ,
"@type": dfc-b:PaymentMethod dfc-b:hasPaymentState: dfc-v:Unpaid ,
dfc-b:paymentMethodType: Example Card PaymentMethod dfc-b:hasPaymentMethod: {
dfc-b:paymentMethodProvider: Stripe "@type": dfc-b:PaymentMethod ,
dfc-b:hasPrice: dfc-b:paymentMethodType: Example Card PaymentMethod ,
"@type": dfc-b:QuantitativeValue dfc-b:paymentMethodProvider: Stripe ,
dfc-b:hasUnit: GBP dfc-b:hasPrice: {
dfc-b:value: £0.27 "@type": dfc-b:QuantitativeValue ,
dfc-b:VATrate: 0.00 dfc-b:hasUnit: GBP ,
dfc-b:discount: 1.55 dfc-b:value: £0.27 ,
dfc-b:OrderedBy: http://test.host/api/dfc/Persons/10000 dfc-b:VATrate: 0.00
dfc-b:selects: },
"@type": dfc-b:ShippingOption },
dfc-b:optionOf: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002 dfc-b:discount: 1.55 ,
dfc-b:fee: 1.50 dfc-b:OrderedBy: http://test.host/api/dfc/Persons/10000 ,
dfc-b:uses: dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10050 ,
"@type": dfc-b:PickupOption dfc-b:selects: {
dfc-b:pickedUpAt: Our Fantastic Farm Gate "@type": dfc-b:ShippingOption ,
dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10000 dfc-b:optionOf: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002 ,
dfc-b:hasPart: dfc-b:fee: 1.50 ,
- "@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01 },
"@type": dfc-b:OrderLine dfc-b:uses: {
dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 "@type": dfc-b:PickupOption ,
dfc-b:hasQuantity: dfc-b:pickedUpAt: Our Fantastic Farm Gate
"@type": dfc-b:QuantitativeValue },
dfc-b:hasUnit: Packet dfc-b:hasPart: {
dfc-b:hasValue: 5.0 "@id": http://test.host/api/dfc/Enterprises/10000/Orders/10001/orderlines/10001-01 ,
dfc-b:Price: "@type": dfc-b:OrderLine ,
"@type": dfc-b:QuantitativeValue dfc-b:concerns: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001 ,
dfc-b:hasUnit: GBP dfc-b:hasQuantity: {
dfc-b:value: 19.95 "@type": dfc-b:QuantitativeValue ,
dfc-b:VATrate: 0.0 dfc-b:hasUnit: Packet ,
dfc-b:discount: [] 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: post:
summary: Create an Order summary: Create an Order
parameters: [] parameters: []
tags: tags:
- Orders - Orders
requestBody:
content:
application/json:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@graph": [
{
"@id": null ,
"@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/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: []
}
}
]
responses: responses:
'400': '400':
description: bad request description: bad request
@@ -1062,39 +1189,6 @@ paths:
dfc-b:pickedUpAt: Our Fantastic Farm Gate dfc-b:pickedUpAt: Our Fantastic Farm Gate
dfc-b:soldBy: http://test.host/api/dfc/Enterprises/10000 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 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}": "/api/dfc/Enterprises/{enterprise_id}/Orders/{id}":
parameters: parameters:
@@ -1125,7 +1219,6 @@ paths:
"@type": dfc-b:Order "@type": dfc-b:Order
dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002 dfc-b:belongsTo: http://test.host/api/dfc/Enterprises/10000/SaleSessions/10002
dfc-b:orderNumber: "MYORDERNUM:12345" dfc-b:orderNumber: "MYORDERNUM:12345"
dfc-b:date: "2024-05-23" # Order date
dfc-b:hasOrderStatus: dfc-v:Draft dfc-b:hasOrderStatus: dfc-v:Draft
dfc-b:hasFulfilmentStatus: dfc-v:Held dfc-b:hasFulfilmentStatus: dfc-v:Held
dfc-b:hasPaymentState: dfc-v:Unpaid dfc-b:hasPaymentState: dfc-v:Unpaid