Edit this page on GitHub

Home > docs > api > JSON Store

JSON Store

The API for working with Concord JSON Stores, the data in stores and named queries.

JSON Stores

Create or Update a JSON Store

Creates or updates a JSON Store with the specified parameters.

  • URI /api/v1/org/{orgName}/jsonstore
  • Method POST
  • Headers Authorization, Content-Type: application/json
  • Body
      {
        "id": "...",
        "name": "myStore",
        "visibility": "PRIVATE",
        "owner": {
          "id": "...",
          "username": "...",
          "userDomain": "...",
          "userType": "..."
        }
      }
    

    All parameters except name are optional.

  • Success response
      Content-Type: application/json
    
      {
        "result": "CREATED",
        "ok": true,
        "id": "..."
      }
    

Get a JSON Store

Returns a previously created JSON store configuration.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}
  • Method GET
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    
      {
        "orgId": "...",
        "orgName": "...",
        "id": "...",
        "name": "myStore",
        "visibility": "PRIVATE",
        "owner": {
          "id": "...",
          "username": "...",
          "userDomain": "...",
          "userType": "..."
        }
      }
    

Delete a JSON Store

Removes an existing JSON store and all its data and associated queries.

Warning: the operation is irreversible.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}
  • Method DELETE
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    
      {
        "ok": true,
        "result": "DELETED"
      }
    

List Stores

Lists all existing JSON stores for the specified organization.

  • URI /api/v1/org/${orgName}/jsonstore
  • Method GET
  • Body none
  • Success response
      Content-Type: application/json
    
      [
        { "orgId":  "...", "orgName":  "...", "id": "...", "name": "...", "visibility": "...", "owner": { ... } },
        ...
      ]
    

Get Current Capacity for a JSON Store

Returns the current capacity for a specified JSON store. The size parameter is the size of all items in the store and the maxSize is the maximum allowed size of the store (-1 if unbounded).

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/capacity
  • Method GET
  • Body none
  • Success response
      Content-Type: application/json
    
      {
        "size": "...",
        "maxSize": "..."
      }
    

List Current Access Rules

Returns store’s current access rules.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/access
  • Method GET
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    
      [
        {"teamId": "...", "orgName": "...", "teamName":  "...", "level":  "..."},
        ...
      ]
    

Update Access Rules

Updates stores’s access rules for a specific team.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/access
  • Method POST
  • Headers Authorization, Content-Type: application/json
  • Body
      Content-Type: application/json
    
      {
        "teamId": "...",
        "orgName": "...",
        "teamName": "...",
        "level": "..."
      }
    
  • Success response
      Content-Type: application/json
    
      {
        "ok": true,
        "result": "UPDATED"
      }
    

Items

Create or Update an Item

Creates or updates a JSON store items.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/item/${itemPath}
  • Query parameters
    • itemPath: a unique value to identify the data and can contain path separators (e.g. dir1/dir2/item)
  • Method PUT
  • Headers Authorization, Content-Type: application/json
  • Body any valid JSON object:

      {
        ...
      }
    
  • Success Response
      Content-Type: application/json
    
      {
        "ok": true,
        "result": "UPDATED"
      }
    

Get an Item

Returns a previously created JSON store item.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/item/${itemPath}
  • Query parameters
    • itemPath: item’s identifier.
  • Method GET
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    

    a valid JSON.

List Items

Lists items in the specified JSON store.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/item?offset=${offset}&limit=${limit}&filter=${filter}
  • Query parameters
    • limit: maximum number of records to return;
    • offset: starting index from which to return;
    • filter: filters items by name (substring match, case-insensitive).
  • Method GET
  • Body none
  • Success response
      Content-Type: application/json
    
      [
        "item1",
        "item2",
        ...
      ]
    

Delete an Item

Removes an item from the specified JSON store.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/item/${itemPath}
  • Query parameters
    • itemPath: item’s identifier.
  • Method DELETE
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    
      {
        "ok": true,
        "result": "DELETED"
      }
    

Queries

Create or Update a Query

Creates a new or updates an existing named query.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/query
  • Method POST
  • Headers Authorization, Content-Type: application/json
  • Body
      {
        "name": "myQuery",
        "text": "select from ..."
      }
    
  • Success Response
      Content-Type: application/json
    
      {
        "ok": true,
        "result": "CREATED"
      }
    

Get a Query

Returns a previously created named query.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/query/${queryName}
  • Method GET
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    
      {
        "storeId": "...",
        "id": "...",
        "name": "...",
        "text": "..."
      }
    

List Queries

Lists named queries in the specified JSON store.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/query?offset=${offset}&limit=${limit}&filter=${filter}
  • Query parameters
    • limit: maximum number of records to return;
    • offset: starting index from which to return;
    • filter: filters queries by name (substring match, case-insensitive).
  • Method GET
  • Body none
  • Success response
      Content-Type: application/json
    
      [
        { "name": "...", "text": "..." },
        ...
      ]
    

Delete a Query

Removes a named query from the specified JSON store.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/query/${queryName}
  • Method DELETE
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    
      {
        "ok": true,
        "result": "DELETED"
      }
    

Execute a Query

Executes a previously created query using the submitted body as the query’s parameter. Returns a list of rows.

  • URI /api/v1/org/${orgName}/jsonstore/${storeName}/query/${queryName}/exec
  • Method POST
  • Headers Authorization, Content-Type: application/json
  • Body any valid JSON object.
  • Success response
      Content-Type: application/json
    
      [
        ...
      ]