Sign inSign up

ganomede/data

By ganomede

•Updated almost 6 years ago

ganomede generic public data microservice

Image
1

1.9K

ganomede/data repository overview

⁠ganomede-data

Expose public data.

⁠Configuration

Environment variables:

  • HOST — interface to listen on ('127.0.0.1');
  • PORT — port to listen on ('127.0.0.1');
  • API_SECRET — non-empty string for authorizing non-read operations;
  • REDIS_DATA_PORT_6379_TCP_ADDR — hostname of Redis instance to store documents in;
  • REDIS_DATA_PORT_6379_TCP_PORT — port of Redis instance to store documents in.

⁠API

⁠Create document /data/v1/docs/ [POST]
⁠Body
{ "secret": "API_SECRET",
  "document": {/*…*/}      // JSON to insert.
  "id": "idString"         // Optional ID to insert document with
                           // (if missing, newly created UUID v4 is used).
}
⁠Response [200 OK]
{ "id": "idString" }  // ID of created document.
⁠Response [403 Forbidden]

Invalid secret.

⁠Create or update multiple documents /data/v1/docs/_bulk_upsert [POST]

Creates multiple documents, existing documents are overwritten. This is transactional — either all upserts will succeed, or none of them.

⁠Body
{ "secret": "API_SECRET",
  // Pass in an object, where keys are ids and values are documents:
  "documents": {
    "key-1": {"a": {"body": "for key-1"}}, // JSON to upsert at `key-1`
    "key-1": {"something": "else"},        // JSON to upsert at `key-2`
    /* … */
  }
}
⁠Response [200 OK]

Array of IDs.

[ "key-1",
  "key-2",
  /* … */
]
⁠Response [403 Forbidden]

Invalid secret.

⁠List or Search Documents' IDs /data/v1/docs [GET]

List IDs of all documents, or specify q query string parameter to filter only matching set (substring or redis glob⁠).

⁠Response [200 OK]
[
  "matchin-id",
  "another-matching-id",
  // …
]
⁠Read document /data/v1/docs/:id [GET]
⁠Response [200 OK]
{ /*…*/ }  // Document itself as created (without id).
⁠Response [404 Not Found]

Document with specified :id was not found.

⁠Replace document /data/v1/docs/:id [POST]
⁠Body
{ "secret": "API_SECRET" }
⁠Response [200 OK]

Document replaced.

⁠Response [404 Not Found]

Document with specified :id was not found.

⁠Response [403 Forbidden]

Invalid secret.

⁠Delete document /data/v1/docs/:id [DELETE]
⁠Body
{ "secret": "API_SECRET" }
⁠Response [200 OK]

Document deleted or does not exist.

⁠Response [403 Forbidden]

Invalid secret.

Tag summary

Content type

Image

Digest

Size

342.3 MB

Last updated

almost 6 years ago

docker pull ganomede/data