Use FQM APIs to return desired fields for inventory records [ECS]

Use FQM APIs to return desired fields for inventory records [ECS]

The following queries can be used in Ramsons or Sunflower environments to query data in FQM. The following examples use the asynchronous FQM endpoints to query the simple ET for a given record type. Note: as of Sunflower, the simple ETs for Instances, Holdings, Items does not support cross-tenant querying.

Instances - query all Instances in Central tenant:

The POST call should use the Async FQM API to query all instance records in the central tenant. Then the GET call can be used to retrieve the query results. For each record it will return the record ID, the tenant ID and the jsonb; this call should be repeated until all results are returned, incrementing the offset by the limit after each request.

  1. POST /query (Async) https://s3.amazonaws.com/foliodocs/api/folio-query-tool-metadata/s/queryTool.html#tag/fqlQuery/operation/runFqlQueryAsync

    • header: x-okapi-tenant for Central tenant

    • body:

      { "entityTypeId": "8fc4a9d2-7ccf-4233-afb8-796911839862", "fqlQuery": "{\"tenant_id\":{\"$eq\":\"<central_tenant_id>\"},\"_version\":\"15\"}", "fields": ["id", "tenant_id", "jsonb"] }
  2. GET /query/{queryid} (Async) https://s3.amazonaws.com/foliodocs/api/folio-query-tool-metadata/s/queryTool.html#tag/fqlQuery/operation/getQuery x

    • header: x-okapi-tenant for Central tenant

    • use the queryid from the response in the POST

    • params:

      • includeResults true

      • limit 10000

      • offset (whatever value to eventually get all of the records)

Instances - query all Instances in a member tenant:

The POST call should use the Async FQM API to query all instance records in a given member tenant. Then the GET call can be used to retrieve the query results. For each record it will return the record ID, the tenant ID and the jsonb; this call should be repeated until all results are returned, incrementing the offset by the limit after each request.

  1. POST /query (Async) https://s3.amazonaws.com/foliodocs/api/folio-query-tool-metadata/s/queryTool.html#tag/fqlQuery/operation/runFqlQueryAsync

    • header: x-okapi-tenant for a member tenant

    • body:

      { "entityTypeId": "8fc4a9d2-7ccf-4233-afb8-796911839862", "fqlQuery": "{\"shared\":{\"$eq\":\"local\"},\"_version\":\"15\"}", "fields": ["id", "tenant_id", "jsonb", "shared"] }
  2. GET /query/{queryid} (Async) https://s3.amazonaws.com/foliodocs/api/folio-query-tool-metadata/s/queryTool.html#tag/fqlQuery/operation/getQuery x

    • header: x-okapi-tenant for a member tenant

    • use the queryid from the response in the POST

    • params:

      • includeResults true

      • limit 10000

      • offset (whatever value to eventually get all of the records)

Holdings - query all Holdings records in Member tenant:

The POST call should use the Async FQM API to query all holdings records in a given member tenant. Then the GET call can be used to retrieve the query results. For each record it will return the record ID, the tenant ID and the jsonb; this call should be repeated until all results are returned, incrementing the offset by the limit after each request.

  1. POST /query (Async) https://s3.amazonaws.com/foliodocs/api/folio-query-tool-metadata/s/queryTool.html#tag/fqlQuery/operation/runFqlQueryAsync

    • header: x-okapi-tenant for a member tenant

    • body:

      { "entityTypeId": "30a5cfad-1868-4f46-86b9-a6ef67e2d9bf", "fqlQuery": "{\"id\":{\"$empty\":\"false\"},\"_version\":\"15\"}", "fields": ["id", "tenant_id", "jsonb"] }
  2. GET /query/{queryid} (Async) https://s3.amazonaws.com/foliodocs/api/folio-query-tool-metadata/s/queryTool.html#tag/fqlQuery/operation/getQuery x

    • header: x-okapi-tenant for a member tenant

    • use the queryid from the response in the POST

    • params:

      • includeResults true

      • limit 10000

      • offset (whatever value to eventually get all of the records)

Items - query all Item records in Member tenant:

The POST call should use the Async FQM API to query all item records in a given member tenant. Then the GET call can be used to retrieve the query results. For each record it will return the record ID, the tenant ID and the jsonb; this call should be repeated until all results are returned, incrementing the offset by the limit after each request.

  1. POST /query (Async) https://s3.amazonaws.com/foliodocs/api/folio-query-tool-metadata/s/queryTool.html#tag/fqlQuery/operation/runFqlQueryAsync

    • header: x-okapi-tenant for a member tenant

    • body:

      { "entityTypeId": "372e025a-9444-473a-9ffd-fa0f63db1674", "fqlQuery": "{\"id\":{\"$empty\":\"false\"},\"_version\":\"15\"}", "fields": ["id", "tenant_id", "jsonb"] }
  2. GET /query/{queryid} (Async) https://s3.amazonaws.com/foliodocs/api/folio-query-tool-metadata/s/queryTool.html#tag/fqlQuery/operation/getQuery x

    • header: x-okapi-tenant for a member tenant

    • use the queryid from the response in the POST

    • params:

      • includeResults true

      • limit 10000

      • offset (whatever value to eventually get all of the records)