Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 7.4.3

...

  1.  Navigate to the call that you want to try out.
  2.  Expand the call to view its details, then click the "Try it out" button.

    Expand


  3. Input the desired parameters to test, and click "Execute".

    Expand

    If the call is a method that uses a JSON request body, you will have the option to edit the body text in the "Example Value" box - when done, click "Execute".


  4. The example response will display under "Responses" after being executed. The "Response" section also includes the cURL command, Request URL, and Response Headers.

    Expand


APIv2 - Nested Queries

You can use nesting to write more complicated API calls to handle multiple conditions. Here, we'll  illustrate a query with an OR / AND condition, such as to find resource entries with (Section = 76 OR Section = 77) AND managed = Yes:

Code Block
{"type": "entry","attrs":[{"key":"_custom_id","value":"101","rule":"AND"},{"attr_rule":"AND","attr_nested":[{"attr_key":"_section","attr_value":"78","attr_rule":"OR"},{"attr_key":"_section","attr_value":"74","attr_rule":"OR"}]}]}

You should be able to adapt that to point at whatever attributes you like. 

Here it is in CURL format:

Code Block
curl -X POST "https://2-dev.6connect.com/qa-7.4.1/api/v2/resources/query" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"type\":\"entry\",\"attrs\":[{\"key\":\"_custom_id\",\"value\":\"101\",\"rule\":\"AND\"},{\"attr_rule\":\"AND\",\"attr_nested\":[{\"attr_key\":\"_section\",\"attr_value\":\"78\",\"attr_rule\":\"OR\"},{\"attr_key\":\"_section\",\"attr_value\":\"74\",\"attr_rule\":\"OR\"}]}]}"


APIv2 - Using cURL

One option to execute an APIv2 call is to use CURL from the Command Line.

...

Info
titleTip!

Swagger displays cURL commands and request URLs in the execution response!

Use the "Try it Now" feature from your instance's Swagger page (Accessed from Admin → API Tab → APIv2 Swagger Documentation) for the endpoint/attribute changes you wish to make, and view the cURL command for that change. Copy the command text, and use it as a template for your next cURL execution of the command!

For help using Swagger to test endpoints, see "Testing Endpoints in Swagger" in this APIv2 34046545 documentation page.


cURL Examples

...

Review the general CURL documentation at https://curl.haxx.se/ can offer greater insight into what other flags can be used. 

Example: cURL / APIv2 Nested Query

You can use nesting to write more complicated API calls to handle multiple conditions. Here, we'll  illustrate a query with an OR / AND condition, such as to find resource entries with (Section = 76 OR Section = 77) AND managed = Yes:

{"type": "entry","attrs":[{"key":"_custom_id","value":"101","rule":"AND"},{"attr_rule":"AND","attr_nested":[{"attr_key":"_section","attr_value":"78","attr_rule":"OR"},{"attr_key":"_section","attr_value":"74","attr_rule":"OR"}]}]}

The items in bold red are the necessary components to achieve the AND/OR condition in a nested format, though the attributes used may be changed depending on your needs

The same query in cURL is given below:

Code Block
languagebash
curl -X POST "https://2-dev.6connect.com/qa-7.4.1/api/v2/resources/query" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"type\":\"entry\",\"attrs\":[{\"key\":\"_custom_id\",\"value\":\"101\",\"rule\":\"AND\"},{\"attr_rule\":\"AND\",\"attr_nested\":[{\"attr_key\":\"_section\",\"attr_value\":\"78\",\"attr_rule\":\"OR\"},{\"attr_key\":\"_section\",\"attr_value\":\"74\",\"attr_rule\":\"OR\"}]}]}"


Additional Information

See the following areas for additional information:

...