Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
825 lines (784 sloc) 31.6 KB
#%RAML 0.8
# Copyright 2014 Open Ag Data Alliance
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
title: Open Ag Data Alliance
version: v0.3
baseUri: https://{rootUri}/{version}
baseUriParameters:
rootUri:
description: |
The root URI for a particular implementation of OADA. This *MUST*
include a domain and *MAY* include a path to allow coexistence with
other REST APIs.
example: api.oada.io, api.oada.io/OADA
documentation:
- title: Overview
content: |
The OADA API is intended to serve as a specification for all
providers that desire to be OADA compliant. This API does not
attempt to define or enforce a single industry data standard. The
goal of this API is to enable interoperability between the many
precision ag software systems and existing industry data types. By
providing an extensible API that focuses on information exchange
and facilitates data transformations, an open heterogeneous
environment that supports many legacy, current, and future data
formats can be embraced.
- title: Readme
content: !include README.md
- title: License
content: !include LICENSE
protocols: [ HTTPS ]
#schemas:
securitySchemes:
- oauth_2_0:
description: |
OADA supports OAuth 2.0 for authenticating all API requests.
type: OAuth 2.0
describedBy:
headers:
Authorization: &authorization
description: |
Used to send a valid OAuth 2 access token.
example: |
Authorization: Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
responses:
401: &resp401
description: |
Bad or expired token. This can happen if the token
expired. To fix, you should re-authenticate the
user.
403: &resp403
description: |
Bad OAuth request (wrong consumer key, bad nonce,
expired timestamp...). Unfortunately,
re-authenticating the user won't help here.
settings:
authorizationUri: https://{rootUri}/oauth2/authorize
accessTokenUri: https://{rootUri}/oauth2/token
authorizationGrants: [ token ]
resourceTypes: !include resource-types.raml
traits:
- paginated:
queryParameters:
offset:
type: integer
default: 0
minimum: 0
description: |
The collection index of the first item in this page.
example: 20
limit:
type: integer
default: <<defaultLimit>>
minimum: 1
description: |
The number of items from the collection in this page.
example: 10
responses:
400:
- filterable:
queryParameters:
q:
type: string
required: false
description: |
TODO: The exact format of search queries is still under
development.
example:
responses:
400:
- expandable:
queryParameters:
_expand:
type: boolean
default: false
description: |
Expand all document href properties to their actual
resource.
responses:
400:
/resources:
type: collection
description: |
Explore and manage resources in the data storage.
get:
description: |
Returns a paginated collection of all resources owned by the
currently authenticated user. The results can be limited by an
optional query parameter filter.
is: [ paginated: {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources.get.json
post:
description: |
Uploads a new resource and returns the resulting document.
headers:
Content-Disposition:
queryParameters:
derivativeOf: &derivativeOf
type: string
description: |
Optional parameter. If included it must be a valid href to
the resource of which the data is a derivative of. The
OADA implementation will automatically add the new resource
to the referenced resources derivative list.
example: https://openag.io/resources/d3jcds9
body:
multipart/form-data: &formUpload
formParameters:
blob:
type: file
required: true
description: |
The data blob to be uploaded.
/{resourceId}:
type: instance
description: |
Add, edit, and delete resources in storage.
uriParameters:
resourceId:
type: string
description: |
The id of this resource in the data storage.
get:
description: |
Returns the contents of the given resource.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id.get.json
head:
description: |
Returns the headers for the given resource.
put:
description: |
Creates or Updates a resource with given resource id.
headers:
Content-Disposition:
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id.get.json
body:
multipart/form-data: *formUpload
patch:
description: |
Patches a resource with given resource id.
headers:
Content-Disposition:
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id.get.json
delete:
description: |
Deletes the specified resource and its associated data.
responses:
404:
/_id:
type: informational
get:
description: |
Returns the id corresponding to this resource.
/_meta:
type: datum
description: |
Document of metadata associated with the resource's data.
get:
description: |
Returns the value of the given _meta data key.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-meta.get.json
404:
put:
description: |
Creates or Updates the value of the given _meta data key.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-meta.get.json
201:
body:
application/json:
example: !include examples/resources/resources-id-meta.get.json
patch:
description: |
Patches the value of the given _meta data key.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-meta.get.json
head:
description: |
Returns the headers for the given resource's _meta data.
responses:
404:
/{key}:
type: instance
description: |
Create, Update, and Delete the values of the given key.
uriParameters:
key:
type: string
description: |
Key in the given resource data keystore.
get:
description: |
Returns the value of the given key.
put:
description:
Updates or Creates a value under the given key. If the
key already exists, the original value will be lost.
body:
multipart/form-data: *formUpload
post:
description: |
Adds a single or set of key-value pairs to the store.
body:
application/json:
schema: !!null
delete:
description: |
Deletes the given key and its value.
/formats:
type: informational
get:
description: |
Returns a collection of resource formats that the given
resource can be returned as.
is: [ paginated : {defaultLimit: 100}, filterable, expandable ]
body:
application/json:
schema: !!null
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-formats.get.json
/changes:
type: informational
get:
description: |
Returns a collection of changes to this resource and all of
the resources in its tree of children.
queryParameters:
lastChangeId:
type: string
description: |
Optional. If provided the returned list of changes
starts with the change directly following the given
id.
is: [ paginated : {defaultLimit: 100}, filterable, expandable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-changes.get.json
/parents:
type: collection
description: |
Add, remove, and list directories that are parents to the
given directory.
get:
description: |
Returns a paginated collection of all directories that are
parents to the given directory. The results can be limited
by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-parents.get.json
post:
description: |
Adds a parent directory to the given directory.
body:
application/json:
schema: !!null
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-parents-id.get.json
/{parentId}:
type: reference
uriParameters:
parentId:
type: string
description: |
The id of a folder resource containing this
resource.
get:
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-parents-id.get.json
/children:
type: collection
description: |
Add, remove, and list directories that are parents to the
given directory.
get:
description: |
Returns a paginated collection of all directories that are
children of the given directory. The results can be limited
by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-children.get.json
post:
description: |
Adds a child directory to the given directory.
body:
application/json:
schema: !!null
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-children-id.get.json
/{childId}:
type: reference
get:
description: |
Returns a document describing the given child.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-children-id.get.json
/permissions:
type: collection
description: |
Add, remove, and list sharing permissions of this resource.
There are three permission levels:
- owner
- reader
- writer
There are four permission types:
- user - local user id
- domain - all users of a particular identity provider
- anyone - publicly available
- group - user created grouping of other users (`/groups`)
get:
description: |
Returns a paginated collection of all permissions associated
with the given directory. The results can be limited
by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-permissions.get.json
post:
description: |
Creates a permission for this resource.
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
/{permissionId}:
type: datum
get:
description: |
Returns the permission document associated with the
given permission id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
404:
put:
description: |
Creates or Updates a permission document associated with
the given permission id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
201:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
404:
patch:
description: |
Updates a permission document associated with
the given permission id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
404:
/syncs:
type: collection
description: |
Set up synchronization between a resource on two different OADA
compliant implementations. Push notifications or polling can be
used.
get:
description: |
Returns a paginated collection of all syncs associated
with the given resource. The results can be limited
by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-syncs.get.json
post:
description: |
Creates a sync for this resource.
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_poll.get.json
/{syncId}:
type: datum
get:
description: |
Returns the sync document associated with the given
resource/sync id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_push.get.json
404:
put:
description: |
Creates or Updates a sync document associated with the
given resources/syncn id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_poll.get.json
201:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_push.get.json
404:
patch:
description: |
Updates a sync document associated with the given
resource/sync id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_push.get.json
404:
/derivatives:
type: collection
description: |
Add, remove, and list resources that are derivatives of this
resource.
get:
description: |
Returns a paginated collection of all the resources that are
derivatives to the given resource. The results can be
limited by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-derivatives.get.json
post:
description: |
Adds a derivative to the given resource.
body:
application/json:
schema: !!null
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-derivatives-id.get.json
/{derivativeId}:
type: reference
uriParameters:
derivativeId:
type: string
description: |
The id of a particular derivative for this
resource.
get:
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-derivatives-id.get.json
/bookmarks:
type: collection
description: |
Explore and manage farm bookmark data such as fields, machines,
etc. Eventually this data will help directly query resources.
get:
description: |
Returns a paginated collection of all bookmarks for the
currently authenticated user. The results can be limited by an
optional query parameter filter.
is: [ paginated: {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/configs/configs.get.json
post:
description: |
Creates one or more new keys.
body:
application/json:
schema: !!null
responses:
201:
body:
application/json:
example: !include examples/configs/configs.get.json
/{bookmarkKey}: &_bookmarkKey
type: datum
description: |
Custom key heirachy that resloves a resource that is the
bookmark.
get:
description: |
Returns the key resource.
responses:
200:
body:
application/json:
example: !include examples/configs/configs-id.get.json
404:
put:
description: |
Creates or Updates the given bookmark key
body:
application/json:
schema: !!null
responses:
200:
body:
application/json:
example: !include examples/configs/configs-id.get.json
201:
body:
application/json:
example: !include examples/configs/configs-id.get.json
patch:
description: |
Updates the given key.
body:
application/json:
schema: !!null
responses:
200:
body:
application/json:
example: !include examples/configs/configs-id.get.json
404:
delete:
description: |
Deletes the specified key.
responses:
404:
/about:
type: informational
description: |
A document that describes the current user and session.
get:
responses:
200:
body:
application/json:
example: !include examples/about/about.get.json
/users:
type: collection
description: |
The list of all users known to the current user.
get:
responses:
200:
body:
application/json:
example: !include examples/users/users.get.json
post:
responses:
201:
body:
application/json:
example: !include examples/users/users.get.json
/{userId}:
type: datum
description: |
A document describing various information about a given user.
get:
responses:
200:
body:
application/json:
example: !include examples/users/users-id.get.json
put:
responses:
200:
body:
application/json:
example: !include examples/users/users-id.get.json
201:
body:
application/json:
example: !include examples/users/users-id.get.json
patch:
responses:
200:
body:
application/json:
example: !include examples/users/users-id.get.json
/groups:
type: collection
description: |
The list of all groups defined by the current user.
get:
responses:
200:
body:
application/json:
example: !include examples/groups/groups.get.json
post:
responses:
201:
body:
application/json:
example: !include examples/groups/groups.get.json
/{groupId}:
type: datum
description: |
A document listing the users in a given group.
get:
responses:
200:
body:
application/json:
example: !include examples/groups/groups-id.get.json
put:
responses:
200:
body:
application/json:
example: !include examples/groups/groups-id.get.json
201:
body:
application/json:
example: !include examples/groups/groups-id.get.json
patch:
responses:
200:
body:
application/json:
example: !include examples/groups/groups-id.get.json
/authorizations:
type: collection
description: |
The list of all active authorizations, e.g., tokens, for the current
user.
get:
responses:
200:
body:
application/json:
example: !include examples/authorizations/authorizations.get.json
post:
responses:
201:
body:
application/json:
example: !include examples/authorizations/authorizations.get.json
/{authorizationId}:
type: datum
description: |
A document describing the details of a particular authorization.
For example: assignee, scope, expiration time, etc.
get:
responses:
200:
body:
application/json:
example: !include examples/authorizations/authorizations-id.get.json
put:
responses:
200:
body:
application/json:
example: !include examples/authorizations/authorizations-id.get.json
201:
body:
application/json:
example: !include examples/authorizations/authorizations-id.get.json
patch:
responses:
200:
body:
application/json:
example: !include examples/authorizations/authorizations-id.get.json
/.well-known:
/oada-configuration:
type: informational
description: |
JSON document used to discover the specific implementation's OADA
configuration.
See [RFC5785][RFC].
[RFC]: http://www.ietf.org/rfc/rfc5785.txt "RFC5785"
get:
responses:
200:
body:
application/json:
example: !include examples/well-known/oada-configuration.get.json
/openid-configuration:
type: informational
description: |
Defined in [OpenID Connect Discovery 1.0][openid].
[openid]: http://openid.net/specs/openid-connect-discovery-1_0.html#WellKnownContents "OpenID Connect Discovery 1.0"
get:
responses:
200:
body:
application/json:
example: !include examples/well-known/openid-configuration.get.json