Files
openfoodnetwork/swagger.yaml

868 lines
23 KiB
YAML

openapi: 3.0.1
info:
title: The Open Food Network
description: Some endpoints are public and require no authorization; others require authorization. Talk to us to get your credentials set up. Check out our repo! https://github.com/openfoodfoundation/openfoodnetwork
version: '0.1'
servers:
- url: 'https://staging.katuma.org/api'
tags:
- name: products
description: Product endpoints
- name: product variants
description: Product variant endpoints
- name: orders
description: Order endpoints
- name: taxonomies
description: Taxonomy endpoints
- name: taxons
description: Taxon endpoints
- name: cookies_consent
description: Cookies_Consent endpoints
paths:
/products/bulk_products:
get:
description: Gets all Products.
tags:
- products
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
pagination:
$ref: '#/components/schemas/Pagination'
pages:
type: integer
products:
type: array
items:
$ref: '#/components/schemas/Product'
/products/overridable:
get:
description: Gets all Products.
tags:
- products
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
pagination:
$ref: '#/components/schemas/Pagination'
pages:
type: integer
products:
type: array
items:
$ref: '#/components/schemas/Product'
/products:
post:
description: Posts a new Product.
tags:
- products
parameters:
- in: path
name: product_object
schema:
type: object
properties:
product:
$ref: '#/components/schemas/Product'
required: true
description: JSON object representing the Product to be posted.
responses:
'201':
description: successful post
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
/products/{product_id}:
get:
description: Gets a Product by ID.
tags:
- products
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
put:
description: Updates the Product with the given ID.
tags:
- products
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
- in: path
name: product_object
schema:
type: object
properties:
product:
$ref: '#/components/schemas/Product'
required: true
description: JSON object representing the Product attributes to be overwritten.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
delete:
description: Deletes the Product with the given ID.
tags:
- products
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
responses:
'204':
description: successful deletion
/products/{product_id}/clone:
post:
description: Clones a Product by ID.
tags:
- products
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product to clone.
responses:
'201':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
/products/{product_id}/soft_delete:
delete:
description: Soft deletes the Product with the given ID.
tags:
- products
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
responses:
'204':
description: successful deletion
/products/{product_id}/variants:
get:
description: Gets all Variants of the given Product.
tags:
- product variants
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
count:
type: integer
total_count:
type: integer
variants:
type: array
items:
$ref: '#/components/schemas/Variant'
pages:
type: integer
current_page:
type: integer
post:
description: Posts a new Product Variant.
tags:
- product variants
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
- in: path
name: variant_object
schema:
type: object
properties:
variant:
$ref: '#/components/schemas/Variant'
required: true
description: JSON object representing the Variant to be posted. Only attributes listed in the Variant required_attributes object are required (obtainable via GET /products/{product_id}/variants/new).
responses:
'201':
description: successful post
content:
application/json:
schema:
$ref: '#/components/schemas/Variant'
/products/{product_id}/variants/{variant_id}:
get:
description: Gets a Variant by ID.
tags:
- product variants
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
- in: path
name: variant_id
schema:
type: integer
required: true
description: Numeric ID of the Variant.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Variant'
put:
description: Updates the Variant with the given ID.
tags:
- product variants
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
- in: path
name: variant_id
schema:
type: integer
required: true
description: Numeric ID of the Variant.
- in: path
name: variant_object
schema:
type: object
properties:
variant:
$ref: '#/components/schemas/Variant'
required: true
description: JSON object representing the Variant attributes to be overwritten.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Variant'
delete:
description: Deletes the Variant with the given ID.
tags:
- product variants
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
- in: path
name: variant_id
schema:
type: integer
required: true
description: Numeric ID of the Variant.
responses:
'204':
description: successful deletion
/products/{product_id}/variants/{variant_id}/soft_delete:
delete:
description: Soft-deletes the Variant with the given ID.
tags:
- product variants
parameters:
- in: path
name: product_id
schema:
type: integer
required: true
description: Numeric ID of the Product.
- in: path
name: variant_id
schema:
type: integer
required: true
description: Numeric ID of the Variant.
responses:
'204':
description: successful deletion
/orders:
get:
description: Gets all Orders.
tags:
- orders
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
orders:
type: array
items:
$ref: '#/components/schemas/Order_Concise'
pagination:
type: string
/taxonomies:
get:
description: Gets all Taxonomies.
tags:
- taxonomies
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
count:
type: integer
current_page:
type: integer
taxonomies:
type: array
items:
$ref: '#/components/schemas/Taxonomy'
pages:
type: integer
post:
description: Posts a new Taxonomy.
tags:
- taxonomies
parameters:
- in: path
name: taxonomy_object
schema:
type: object
properties:
taxonomy:
$ref: '#/components/schemas/Taxonomy'
required: true
description: JSON object representing the Taxonomy to be posted. Only attributes listed in the Taxonomy required_attributes object are required (obtainable via GET /taxonomies/new).
responses:
'201':
description: successful post
content:
application/json:
schema:
$ref: '#/components/schemas/Taxonomy'
/taxonomies/new:
get:
description: Gets an object consisting of an array of all Taxonomy attributes and an array of required attributes to create a new Taxonomy object.
tags:
- taxonomies
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/New'
/taxonomies/{taxonomy_id}:
get:
description: Gets a Taxonomy by ID.
tags:
- taxonomies
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Taxonomy'
put:
description: Updates the Taxonomy with the given ID.
tags:
- taxonomies
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
- in: path
name: taxonomy_object
schema:
type: object
properties:
taxonomy:
$ref: '#/components/schemas/Taxonomy'
required: true
description: JSON object representing the Taxonomy attributes to be overwritten.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Taxonomy'
delete:
description: Deletes the Taxonomy with the given ID.
tags:
- taxonomies
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
responses:
'204':
description: successful deletion
/taxons:
get:
description: Gets all Taxons.
tags:
- taxons
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Taxon'
/taxonomies/{taxonomy_id}/taxons/:
get:
description: Gets all Taxons belonging to a given Taxonomy.
tags:
- taxons
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Taxon'
post:
description: Posts a new Taxon to a given Taxonomy.
tags:
- taxons
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
- in: path
name: taxon_object
schema:
type: object
properties:
taxon:
$ref: '#/components/schemas/Taxon'
required: true
description: JSON object representing the Taxon to be posted. Only attributes listed in the Taxon required_attributes object are required (obtainable via GET /taxonomies/{taxonomy_id}/taxons/new).
responses:
'201':
description: successful post
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Taxon'
/taxonomies/{taxonomy_id}/taxons/new:
get:
description: Gets an object consisting of an array of all Taxon attributes and an array of required attributes to create a new Taxon object in a given Taxonomy.
tags:
- taxons
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/New'
/taxonomies/{taxonomy_id}/taxons/{taxon_id}:
get:
description: Gets a Taxon by ID from the Taxonomy at the given Taxonomy ID.
tags:
- taxons
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
- in: path
name: taxon_id
schema:
type: integer
required: true
description: Numeric ID of the Taxon.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Taxon'
put:
description: Updates the Taxon with the given Taxon ID in the Taxonomy with the given Taxonomy ID.
tags:
- taxons
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
- in: path
name: taxon_id
schema:
type: integer
required: true
description: Numeric ID of the Taxon.
- in: path
name: taxon_object
schema:
type: object
properties:
taxon:
$ref: '#/components/schemas/Taxon'
required: true
description: JSON object representing the Taxon attributes to be overwritten.
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Taxon'
delete:
description: Deletes the Taxon with the given Taxon ID from the Taxonomy with the given Taxonomy ID.
tags:
- taxons
parameters:
- in: path
name: taxonomy_id
schema:
type: integer
required: true
description: Numeric ID of the Taxonomy.
- in: path
name: taxon_id
schema:
type: integer
required: true
description: Numeric ID of the Taxon.
responses:
'204':
description: successful deletion
/cookies/consent:
get:
description: Gets the client's Cookies_Consent status.
tags:
- cookies_consent
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Cookies_Consent'
post:
description: Changes the client's Cookies-Consent status to true.
tags:
- cookies_consent
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Cookies_Consent'
delete:
description: Changes the client's Cookies-Consent status to false.
tags:
- cookies_consent
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Cookies_Consent'
components:
securitySchemes:
api_key:
type: apiKey
name: api_key
in: header
schemas:
Pagination:
type: object
properties:
results:
type: integer
pages:
type: integer
page:
type: integer
per_page:
type: integer
Product:
type: object
properties:
id:
type: integer
name:
type: string
description:
type: string
price:
type: string
available_on:
type: string
permalink:
type: string
count_on_hand:
type: integer
meta_description:
type: string
meta_keywords:
type: string
taxon_ids:
type: object
variants:
oneOf:
- type: array
items:
$ref: '#/components/schemas/Variant'
- $ref: '#/components/schemas/Variant'
option_types:
type: object
product_properties:
type: object
New:
type: object
properties:
required_attributes:
type: array
items:
type: string
attributes:
type: array
items:
type: string
Variant:
type: object
properties:
id:
type: integer
name:
type: string
count_on_hand:
type: integer
sku:
type: string
price:
type: string
weight:
type: string
height:
type: string
width:
type: string
depth:
type: string
is_master:
type: string
cost_price:
type: string
permalink:
type: string
option_values:
type: object
images:
type: object
Taxonomy:
type: object
properties:
root:
type: object
id:
type: integer
name:
type: string
Taxon:
type: object
properties:
name:
type: string
taxonomy_id:
type: integer
position:
type: integer
permalink:
type: string
taxons:
type: array
items:
$ref: '#/components/schemas/Taxon'
pretty_name:
type: string
id:
type: integer
parent_id:
type: integer
Cookies_Consent:
type: object
properties:
cookies_consent:
type: boolean
example:
cookies_consent: false
Order_Concise:
type: object
properties:
id:
type: integer
number:
type: string
full_name:
type: string
email:
type: string
phone:
type: string
completed_at:
type: string
display_total:
type: string
show_path:
type: string
edit_path:
type: string
state:
type: string
payment_state:
type: string
shipment_state:
type: string
payments_path:
type: string
shipments_path:
type: string
ship_path:
type: string
ready_to_ship:
type: boolean
created_at:
type: string
distributor_name:
type: string
special_instructions:
type: string
payment_capture_path:
type: string
distributor:
type: object
properties:
id:
type: integer
order_cycle:
type: object
properties:
id:
type: integer