milk/apiary.apib
MrJoshua a0e6643a1d Addided basic API docs. Updated readme with contribution instrucitons.
Change-Id: I384a4dbfe9966dc8d07b748df9906aa95012a659
2014-03-13 14:03:35 -07:00

263 lines
8.0 KiB
Plaintext

FORMAT: 1A
# ETC Cound Framework Milk
This is an initial template for the ETC Milk Cloud Production Framework API.
In this form it is setup to define multiple experimental apis for live testing.
# API Dev Root [/]
Milk-Dev entry point. This entry point list all test APIs provided.
## Retrieve Entry Point [GET]
+ Response 200 (application/json)
{interfaces: [
{
type: "registery",
name: "String API",
version "1.0",
description: "String API - Draft 1",
path: "/string/v1"
},
{
type: "reference",
name: "C4 Referece",
version "1",
description: "Parts of the public C4 API",
path: "/c4"
}
]}
# String API [/string/v1]
Data Model (For Phase 1)
The following is a basic set of services to call the String metadata API. While
the HTTP call will most likely use a JSON POST, this remains to be architected.
We have included an example of the HTTP calli in the login API call. In addition,
the return format will need to be determined as well.
# Group Users
| userID | password | userGUID | email |
|--------|-------------|--------------------------------------|----------------|
| dax | Password123 | 550e8400-e29b-41d4-a716-446655440000 | chris@daxcloud |
## User Login [/login]
This is used to login to the String API for the first time. After Phase 1, we
will use the Keystone authentication API. It returns a session token to be used
for the remaining calls.
### Login [POST]
+ Request
{username: "dax", password: "Password123"}
+ Response 200 (application/json)
{
userGUID: "550e8400-e29b-41d4-a716-446655440000",
session_token: "12345678901234567890"
}
# Group Assets and Services
The primary registration method to associate an asset ID with a service type and
a URI for more information. The call takes an optional description for this
association to be retrieved as part of the lookup. In addition, publicly
available metadata key-value pairs can be registered through the optional
metadataPairs structure, which is a JSON-encoded, square-bracketed, quoted list
of data.
`success = associateAsset(assetHash, serviceToken, URI, description, metadataPairs)`
| assetHash | service | URI | description | metadata |
|---------------------------------|---------|------------------------------------------------------|--------------------------------|-----------------------------------------------------|
| 0d6dce44a124443d845af191c3d1b64 | 5 | https://my.service.com/lookup/blah?asset=%assetHash% | The parent owner of this asset | [“Original”, “True”], [“Color-corrected”, “False”], |
| | | | and all of its derivatives is | [“Copyright”, “2014 USC ETC”] |
| | | | the USC ETC. | |
## Assets and Services Collection [/AssetsServices]
### List [GET]
+ Response 200 (applicaiton/json)
[
{
assetHash: "0d6dce44a124443d845af191c3d1b64"
service: 5
URI: "https://my.service.com/lookup/blah?asset=%assetHash%"
description: "The parent owner of this asset and all of its derivatives is the USC ETC."
metadata: {
Original: true,
Color-corrected: false,
Copyright: 2014 USC ETC
}
}
]
## Create [POST]
+ Request
+ Headers
Authorization: Token token="12345678901234567890"
+ Body
{
assetHash: "0d6dce44a124443d845af191c3d1b64"
service: 5
URI: "https://my.service.com/lookup/blah?asset=%assetHash%"
description: "The parent owner of this asset and all of its derivatives is the USC ETC."
metadata: {
Original: true,
Color-corrected: false,
Copyright: 2014 USC ETC
}
}
+ Response 201
## Assets and Services Member [/AssetsServices/{assetHash}]
### Retrieve [GET]
+ Response 200 (application/json)
{
assetHash: "0d6dce44a124443d845af191c3d1b64"
service: 5
URI: "https://my.service.com/lookup/blah?asset=%assetHash%"
description: "The parent owner of this asset and all of its derivatives is the USC ETC."
metadata: {
Original: true,
Color-corrected: false,
Copyright: 2014 USC ETC
}
}
## Update [PUT]
+ Request
+ Headers
Authorization: Token token="12345678901234567890"
+ Body
{
description: "Update description."
}
+ Response 200
## Destroy [DELETE]
+ Request
+ Headers
Authorization: Token token="12345678901234567890"
+ Response 200
# Group Service Registry
| service | serviceName | serviceToken | serviceDescription |
|---------|-----------------------|--------------|--------------------------------------------------|
| 5 | Ownership Information | OWNER | This service type provides ownership information |
| | | | about the asset. A non-parameter call to the URI |
| | | | will provide more information on how to access |
| | | | this service. |
## Assets and Services Collection [/ServiceRegistry]
### List [GET]
+ Response 200 (applicaiton/json)
[
{
service: 5
serviceName: "Ownership Information"
serviceToken: "OWNER"
serviceDescription: "
This service type provides ownership information about the
asset. A non-parameter call to the URI will provide more
information on how to access this service.
"
}
]
## Create [POST]
+ Request
+ Headers
Authorization: Token token="12345678901234567890"
+ Body
{
service: 5
serviceName: "Ownership Information"
serviceToken: "OWNER"
serviceDescription: "
This service type provides ownership information about the
asset. A non-parameter call to the URI will provide more
information on how to access this service.
"
}
+ Response 201
## Assets and Services Member [/ServiceRegistry/{service}]
### Retrieve [GET]
+ Response 200 (application/json)
{
service: 5
serviceName: "Ownership Information"
serviceToken: "OWNER"
serviceDescription: "
This service type provides ownership information about the
asset. A non-parameter call to the URI will provide more
information on how to access this service.
"
}
## Update [PUT]
+ Request
+ Headers
Authorization: Token token="12345678901234567890"
+ Body
{
serviceDescription: "Update serviceDescription."
}
+ Response 200
## Destroy [DELETE]
+ Request
+ Headers
Authorization: Token token="12345678901234567890"
+ Response 200