BC API Discovery

Updated on 20-October-2016 at 10:16 AM

Business Catalyst End of life announcement - find out more details.

What is this?

The BC API Discovery app is an free app we have created that enables users to visually build complex queries. With the release of module_data and our new API endpoints users can access BC data directly.

To effectively access, filter and use this data however, one would need to write quite complex module syntaxes. Using this app you can create the complex syntax for the modules you need in a visual way using an UI rather than writing the code by hand.

Download it from here

The BC API Discovery app can be downloaded from our GitHub repository .

How to install it

The install process is pretty straight forward, all you need to do is upload the app's folder to your site's /_System/apps folder. 

Once all the files are uploaded refresh the Admin console and you should see the app's entry in the console's sidebar.

How it works

After the app is in place you can use it to explore the resources map of BC - that is the resources and sub-resources you can access. You can also see all the fields a certain resource or subresource contains.

Working with the app

Let's build a sample query to see how it works. Let's assume we want to show all the blog posts that belong to a particular blog, that were published by a certain author after a particular date using module_data.

This is the syntax we are trying to build:

{module_data resource="blogposts" collection="blogposts" version="v3" where="\{'blog.id':'10159','createBy':'1054934','createDate':\{'$gt':'2014-01-08'\}\}"}

The syntax as you can see is pretty complex, writing it by hand is pretty complicated considering certain characters need to be escaped, there are alot of quote and double quote marks that need to be paired up.

Using this app however you can visually build the query above with only a few clicks. Here is how:

  • First select the resource (and optionally the sub-resource) you need to access. In our case we need the blogposts resource:
  • Then select the fields you want to use in your output. For this example let's use only the id field.
  • Using the query builder add the conditions and filters you need. You will notice after adding each condition it is mirrored to syntax builder below:

After entering all our conditions the sample syntax will look like this:

{module_data resource="blogposts" version="v3" fields="id" skip="0" limit="10" where="\{'blog.id':'10159','releaseDate':'1054934','createDate':\{'$gt':'2014-01-08'\}\}" order="id" collection="myData"} 

The fields, skip and limit fields are automatically added. You can copy-paste this syntax directly into your page and see what it outputs.

If you click the JQuery panel you will get the syntax you can use in your BC apps: