Cinchy Platform Documentation
Cinchy v5.6

API Saved Queries

This page outlines how to use saved queries with APIs.

Table of Contents

Table of Contents

1. Overview

Cinchy queries are automatically available as REST APIs to allow for external application integration.
See Saved Queries on how to create a saved query. The URL for the REST API can be found on the Execute Query screen (Image 1).
Image 1: Getting the REST API for a Saved Query
https://<Cinchy Web URL>/API/MyDomain/MyQuery
How to Use the Access Token to Call Cinchy APIs

2. Example

The following example shows how to use API Saved Queries (Image 2.)
Image 2: Using API Saved Queries
In the above image, "%40" is the URL encoded version of "@". If you are passing them in as parameters you will need to include the %40 in front of your parameter name.

Use Basic Authentication to Call Cinchy APIs

https://<Cinchy Web URL>/BasicAuthAPI/MyDomain/MyQuery

3. Anonymous Access

The following instructions detail how to allow anonymous access to your saved query API endpoint.
  1. 1.
    Navigate to the table your query will be referencing. In this example, it is the Accessibility Assessments table (Image 1).
  2. 2.
    Navigate to Data Controls > Entitlements.
  3. 3.
    On a new row, add in the Anonymous user and ensure that either "View All Comuns" (to expose all the data) or "View Selected Columns" (to select individual columns) is checked off (Image 3).
Clicking on inline images in Gitbook will open a larger version.
Image 3: The Entitlements Table
4. Design your query (Image 4). For more information on creating new saved queries, click here.
Image 4: Design your Query
5. Once you have written your query, navigate to Design Query > Info, on the left navigation bar.
6. Change your API Result Format to JSON (Image 5).
Image 5: Change your API Result Format to JSON
7. Navigate to Design Controls from the left navigation bar.
8. To ensure that anonymous users have the correct permission needed to execute the query that generates the API response, add the "Anonymous" user to the users permission group uiunder "Who can execute this query?" (Image 6).
Image 6: Ensuring the anonymous user has access
9. Navigate to "Execute Query" from the left navigation bar.
10. Copy your REST API endpoint URL (Image 7).
Image 7: Copy your REST API endpoint URL
11. To confirm that anonymous access has been successfully set up, paste the URL into an incognito/private browser (Image 8).
Image 8: Testing your API

3.1 Troubleshooting

  • 401 errors likely mean you have not added the Anonymous user to the list of users (not "Groups") that can execute the query.
  • 400 errors likely mean that you have not added the Anonymous user to the list of users that (not "Groups") that can view column data from the tables that your query uses.