Developer Guide

CraftAR Management API curl examples

icon Date Developer Guide

icon Date Dec 22, 2020

icon author Catchoom Team

icon folder

In certain circumstances you may find yourself needing to use a raw cURL request to interact with our Management API. If that’s the case, you can use the examples in this article to help you out. Take into account that we strongly recommend using our native CraftAR-PHP and CraftAR-Python libraries to interact with our Management API instead of using cURL. 
The scenarios for which we’ll be showing examples are:

You need Python and the command line tool jq to run these examples. A full script with all the examples can be found here. The code for each example is written in Bash script and can be executed from your command line or saved in a Bash script file separately and executed as long as you include the utility methods from the full script. They each assume that there is an environment variable available called APIKEY which has the value of your account’s API Key that you can get here after logging in with your account.

Create a Cloud Collection

This example creates a Cloud Collection called “My Collection”.

Create an On-Device Collection

This example creates an On-Device Collection called “My Collection” by submitting the “offline” parameter set to “true”

Create an IR (Image Recognition) Item

This example creates an Image Recognition Item called “My Item” in the Collection we created previously.

Create an AR (Augmented Reality) Item

This example creates an Augmented Reality Item called “My Item” in the Collection we created previously.

Create an AR (Augmented Reality) Item with Custom Contents

This example creates an Augmented Reality Item called “My Custom Content Item” in the Collection we created previously and specifying the JSON content which describes the scene for the Augmented Reality. In this example we’re adding an image content and a video content which includes a transparency mask. Read this article to learn how to describe contents programmatically in our JSON format. To know more about how we support videos with transparency in the CraftAR Service and in the SDKs, see how to add videos with transparency to Augmented Reality with CraftAR .  

Create an Image for an Item

This example creates an image on CraftAR from the file called myimage.jpg in the directory where the script is run. The image is associated to the Item we created in the previous examples.

Associate an Application ID to a Collection

This example associates an AppID to an existing collection. In this example we are using the previous On-Device Collection created, but it would also work with any Cloud Collection.

Obtain SDK Version Resource URI to create an On-Device Bundle

This example retrieves the Resource URI for a given SDK Version to be used to create an On-Device Bundle.

Create an On-Device Bundle

This example creates an On-Device Bundle for an existing collection and associated AppID.

Regenerate an On-Device Bundle

This example forces a regeneration of an existing On-Device Bundle by using the same call as Create. You’ll usually want to trigger regeneration of a Bundle when you’ve updated any of the Items in the Collection to which the Bundle is associated.

Obtain Collections for an Application ID

This example retrieves the list of collections for an AppID on your account and some additional data for that AppID.

Related Posts in Developer Guide