Best practices

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

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

Install the free BC API Discovery app

This is a free app that allows you to visually build complex API queries, explore the fields available and more.

It produces code snippets you can then copy-paste right in your app, take a look at the BC API Discovery article for more info, getting started guide and download link.

Use "current" instead of the site ID when calling the APIs

You should use use "current" when making API calls in order to ensure your apps will continue working if you transfer them to other sites, For example if you need to add a new webapp item to the webapp "Some_sample_app" the "url" should be:

/api/v2/admin/sites/current/webapps/Some_sample_app/items

instead of:

/api/v2/admin/sites/18931/webapps/Some_sample_app/items

Here is an example:

You should not access cookies set on Admin Console's domain

Because the App loader will open the app's assets using a different domain you will no longer be able to access information stored in cookies on the Admin Console's domain.

In your code do not rely on the current format of the access token

The access token's length or format might be subject to changed in the future, do not rely on the number, type or case of characters it has at the moment.

We encourage the usage of the SDK over the API endpoints

The SDK will be dontinually improved over the next period, whenever possible please use the methods in the SDK over the regular API calls.

When creating webapps custom fields always make sure you specify their IDs

For example, let's assume in your code you create 3 custom fields "Photo", "Bio" and "Address" in this particular order.

You would assume the IDs will be assigned incrementally like so:

  • Photo - 1
  • Bio - 2
  • Address - 3

However, if the call that creates the "Bio" field is executed last, the IDs will be changed to:

  • Photo - 1
  • Address - 2
  • Bio - 3

Because the calls that create custom fields are async there is no guarantee the fields will be created in the order you make the calls so unless you specify the IDs of the fields their IDs might be assigned incrementally.