Cinchy Platform Documentation
Cinchy v4.0
Cinchy v4.0
  • Dataware Overview
  • Release Notes
    • 4.1 Release Notes
    • 4.2 Release Notes
    • 4.4 Release Notes
    • 4.5 Release Notes
    • 4.6 Release Notes
    • 4.7 Release Notes
    • 4.8 Release Notes
    • 4.10 Release Notes
    • 4.11 Release Notes
    • 4.12 Release Notes
    • 4.13 Release Notes
    • 4.14 Release Notes
    • 4.15 Release Notes
    • 4.16 Release Notes
    • 4.17 Release Notes
    • 4.18 Release Notes
    • 4.19 Release Notes
    • 4.20 Release Notes
    • 4.21 Release Notes
  • Cinchy Guides
    • User
      • My Network
      • User Preferences
      • Table Features
      • Data Management
      • Commentary
      • Query
    • Builder
      • Best Practices
        • Multi-Lingual Support
      • Tables
        • Creating your first table
        • System Columns
        • Column Types
        • Linking Data
        • Indexing and Partitioning
        • Formatting Rules
        • Data Controls (formerly Design Controls)
          • Table Level Entitlements
          • Column Level Entitlements
          • Row Level Entitlements
          • Erasure
          • Compression
      • Building Forms
      • Saved Queries
        • Creating your first query
        • Displaying Query Results
      • Integration
        • BI Integrations
          • Excel
          • Power BI
          • Tableau
        • Other Integrations
          • SAS
      • Data Experience Deployment
    • Frequently Asked Questions
  • API Guide
    • APIs
      • Authentication
      • Saved Queries
      • ExecuteCQL
      • Webhook Ingestion
  • Deployment Guide
    • Planning
      • Deployment Planning Guide
      • Pre-Requisites
    • Installation
      • Maintenance
      • Migration from 1.x
      • Single Sign-On (SSO) Integration
        • Configuring ADFS
        • AD Group Integration
        • High Number of Groups in ADFS
      • Application Experiences
        • Setting Up Experiences
        • My Data Network
        • Custom Data Network Visualizer
      • Advanced Settings
        • Enable Data At Rest Encryption
        • System Properties
  • Other Resources
    • Cinchy Data Sync
    • Cinchy Meta-Forms
    • Cinchy Meta Reports
    • Cinchy Query Language
    • Angular SDK
    • JavaScript SDK
Powered by GitBook
On this page
  • Table of Contents
  • 1. Overview
  • Use Access Token to Call Cinchy APIs
  • 2. Example
  • Use Basic Authentication to Call Cinchy APIs
  • 3. Anonymous Access
  • 3.1 Troubleshooting

Was this helpful?

Export as PDF
  1. API Guide
  2. APIs

Saved Queries

PreviousAuthenticationNextExecuteCQL

Last updated 3 years ago

Was this helpful?

Table of Contents

Table of Contents

1. Overview

See on how to create a saved query. The URL can be found on the Execute Query screen.

Use Access Token to Call Cinchy APIs

GET https://<Cinchy Web URL>/API/MyDomain/MyQuery

To access any Cinchy Saved Query API, pass the access token received from the Bearer Token Request in the Authorization header, prefixed by "Bearer".

Query Parameters

Name
Type
Description

WrapSingleRecordInArray

boolean

Default is true. Add this parameter and set to false if you want single record results returned as an object instead of within an array.

@param

string

If you have parameters in your query, you pass them indirectly as query parameters.

CompressJSON

boolean

Default is true. Add this parameter and set to false if you want the JSON that is returned to be expanded rather than having the schema being returned separately.

Headers

Name
Type
Description

Authorization

string

Bearer <token goes here>

< HTTP/2 200 
< cache-control: private, s-maxage=0
< content-type: application/json; charset=utf-8
< server: Microsoft-IIS/10.0
< x-aspnetmvc-version: 5.2
< access-control-allow-origin: *
< x-aspnet-version: 4.0.30319
< x-powered-by: ASP.NET
< date: Wed, 1 Aug 2020 17:40:13 GMT
< content-length: 2985
--given the following CQL used within a saved query:

IF (ISNULL(@Int,0) = 0)
BEGIN
  RAISERROR('Invalid parameter: @Int cannot be NULL or zero',18,0)
  RETURN
END
IF (ISNULL(@String,'') = '' OR ISNULL(@String,'') = 'X')
BEGIN
  RAISERROR('Invalid parameter: @String cannot be NULL or empty or X',18,0)
  RETURN
END

--note "X-Cinchy-Error" in the sample response:

< HTTP/1.1 400 Bad Request
< Cache-Control: private
< Content-Type: text/html; charset=utf-8
< Server: Microsoft-IIS/10.0
< X-AspNetMvc-Version: 5.2
< Access-Control-Allow-Origin: *
< X-Cinchy-Error: Invalid parameter: @Int cannot be NULL or zero
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Wed, 1 Aug 2020 17:43:04 GMT
< Content-Length: 4517
< HTTP/1.1 401 Unauthorized
< Cache-Control: private
< Content-Type: text/html; charset=utf-8
< Server: Microsoft-IIS/10.0
< X-AspNetMvc-Version: 5.2
< X-AspNet-Version: 4.0.30319

2. Example

%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. Navigate to the table your query will be referencing. In this example, it is the Accessibility Assessments table (Image 1).

  2. Navigate to Data Controls > Entitlements.

  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 1).

Clicking on inline images in Gitbook will open a larger version.

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 3).

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 4).

9. Navigate to "Execute Query" from the left navigation bar.

10. Copy your REST API endpoint URL (Image 5).

11. To confirm that anonymous access has been successfully set up, paste the URL into an incognito/private browser (Image 6).

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.

4. Design your query (Image 2). For more information on creating new saved queries, .

click here
#1.-overview
#2.-example
#3.-anonymous-access
Saved Queries
Image 1: The Entitlements Table
Image 2: Design your Query
Image 3: Change your API Result Format to JSON
Image 4: Ensuring the anonymous user has access
Image 5: Copy your REST API endpoint URL
Image 6: Testing your API