Skip to content

Routes (API)

Junbong Lee edited this page Feb 23, 2017 · 10 revisions

Meta Information API

[GET] /_info : Get overall server information

Collection API

Basic CRUD

[GET] /:collection : Get properties of collection

[POST] /:collection : Create new collection with specified name

[DELETE] /:collection : Remove collection with specified name, either all documents in collection

[PUT] /:collection : Update properties of collection - Future feature

Document API

Basic CRUD

[GET] /:collection/:key : Get document with specified key

Response body:

{
  /* Key of this document */
  "key": "key_of_document"
  /* Value of this document */
  "value": "contents of document",
  /* Timestamp that means when this document created */
  "created_at": 1487808000000
  /* Timestamp that means when this document expired */
  "expired_at": 1487810000000
}

[POST] /:collection/:key : Create new document with specified key

Request body:

{
  /* Value of this document - EMPTY STRING will put when this field is not supplied */
  "value": "put contents of document",
  /* Option that when this document expired in seconds */
  "expire": 10
}

Response body:

{
  /* Key of this document */
  "key": "key_of_document"
  /* Value of this document */
  "value": "contents of document",
  /* Timestamp that means when this document created */
  "created_at": 1487808000000
  /* Timestamp that means when this document expired */
  "expired_at": 1487810000000
}

[DELETE] /:collection/:key : Remove document with specified key

Request body:

{
  /* Option that whether fire expiration callback or not */
  "exp_callback": true
}

[PUT] /:collection/:key : Update document with specified key Request body:

{
  /* Value of this document - EMPTY STRING will put when this field is not supplied */
  "value": "put contents of document",
  /* Option that when this document expired in seconds */
  "expire": 10
}

Response body:

{
  /* Key of this document */
  "key": "key_of_document"
  /* Value of this document */
  "value": "contents of document",
  /* Timestamp that means when this document created */
  "created_at": 1487808000000
  /* Timestamp that means when this document expired */
  "expired_at": 1487810000000
}

Advance / Scan API

[GET] /:collection/_scan/:key_regex : Scan documents with key matched with specified regular expression

Response body:

{
  "documents": [
    /* Key of this document */
    "key": "key_of_document"
    /* Value of this document */
    "value": "contents of document",
    /* Timestamp that means when this document created */
    "created_at": 1487808000000
    /* Timestamp that means when this document expired */
    "expired_at": 1487810000000
  ]
}

[DELETE] /:collection/_scan/:key_regex : Delete documents with key matched with specified regular expression

[PUT] /:collection/_scan/:key_regex : Update documents with key matched with specified regular expression Request body:

{
  /* Value of this document - EMPTY STRING will put when this field is not supplied */
  "value": "put contents of document",
  /* Option that when this document expired in seconds */
  "expire": 10
}
Clone this wiki locally