Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions schema/natural-history-collection-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ paths:
$ref: 'protocol.yml#/paths/~1v1~1protocol'
/v1/protocol/{Id}:
$ref: 'protocol.yml#/paths/~1v1~1protocol~1{Id}'
/v1/site:
$ref: 'site.yml#/paths/~1v1~1site'
/v1/site/{Id}:
$ref: 'site.yml#/paths/~1v1~1site~1{Id}'
/v1/storage-unit:
$ref: 'storageUnit.yml#/paths/~1v1~1storage-unit'
/v1/storage-unit/{Id}:
Expand Down
253 changes: 253 additions & 0 deletions schema/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
openapi: 3.0.0
servers:
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/AAFC/site/1.0.0
info:
description: Site schema
version: "1.0.0"
title: Site schema
contact:
email: you@your-company.com
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
paths:
/v1/site:
get:
tags:
- Site
summary: Get sites
operationId: getSites
description: By passing in query string, user can get available sites authorised
parameters:
- in: query
name: filter[rsql]
description: pass an optional search string for looking up sites
schema:
type: string
- in: query
name: sort
description: optional sort order string, such as descending, denoted by "-"
schema:
type: string
- in: query
name: page[offset]
description: number of records to skip when paging
schema:
type: integer
format: int32
- in: query
name: page[limit]
description: maximum number of records to return when paging
schema:
type: integer
format: int32
minimum: 0
maximum: 50
responses:
'200':
description: sites satisfying the query restrictions
content:
application/vnd.api+json:
schema:
type: array
items:
$ref: '#/components/schemas/Site'
'404':
description: site not found
post:
tags:
- Site
summary: Add site
operationId: addSite
description: Adds a site
responses:
'201':
description: site created
'422':
description: Data integrity violation
requestBody:
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/NewSite'
description: Site to add
/v1/site/{Id}:
get:
tags:
- Site
summary: Find site by ID
description: Returns a single site
operationId: getSiteById
parameters:
- name: Id
in: path
description: ID of site to return
required: true
schema:
type: string
format: uuid
responses:
'200':
description: successful operation
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/Site'
'400':
description: Not a valid uuid
'404':
description: Site not found
patch:
tags:
- Site
summary: Update site
operationId: updateSite
description: update a site
parameters:
- name: Id
in: path
description: site id to patch
required: true
schema:
type: string
format: uuid
responses:
'200':
description: site updated
'400':
description: invalid input, object invalid
requestBody:
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/Site'
description: site to update
delete:
tags:
- Site
summary: Delete site
operationId: deleteSite
description: delete a site
parameters:
- name: Id
in: path
description: site id to delete
required: true
schema:
type: string
format: uuid
responses:
'200':
description: site marked as deleted
'400':
description: Not a valid uuid
'404':
description: site not found
components:
schemas:
Site:
type: object
required:
- data
properties:
data:
type: object
required:
- id
properties:
id:
type: string
format: uuid
example: d290f1ee-6c54-4b01-90e6-d701748f0851
description: Identifier of the object as UUID
allOf:
- $ref: '#/components/schemas/CommonSite'

NewSite:
type: object
required:
- data
properties:
data:
type: object
allOf:
- $ref: '#/components/schemas/CommonSite'

CommonSite:
type: object
required:
- type
- attributes
properties:
type:
enum: [site]
description: The type of data being returned.
attributes:
type: object
properties:
name:
type: string
description: The name of the site
minLength: 1
maxLength: 255
group:
type: string
description: The group in which this site belongs to
code:
type: string
minLength: 1
maxLength: 50
nullable: true
description: Shorthand code for the site
multilingualDescription:
type: object
nullable: true
properties:
descriptions:
type: array
nullable: true
items:
type: object
properties:
lang:
type: string
description: language of the description
desc:
type: string
description: the description
createdBy:
type: string
readOnly: true
description: authenticated user who created the site
createdOn:
type: string
format: date-time
readOnly: true
description: date and time when the site was created in ISO format
example: 1985-04-12T23:20:50.52Z
relationships:
type: object
nullable: true
properties:
attachment:
type: object
nullable: true
description: Multimedia attachments (images, documents, etc.)
properties:
data:
type: array
items:
type: object
required:
- type
- id
properties:
type:
type: string
example: metadata
id:
type: string
format: uuid
description: Unique identifier of the metadata/attachment
example: 8f68a05f-937d-4d40-88b4-ed92720d9c3f