Use the Upload API
You can use the Composer Upload API to dynamically upload and stream your data in real-time. Uploaded data can be in CSV or JSON XML formats. Setting up and configuring an Upload API connector has two parts:
See Manage Connectors and Connector Servers for general instructions on enabling the Upload API connector.
After the connector has been set up, you can create data source configurations that specify the necessary connection information and identify the data you want to use. See Manage Data Source Configurations for more information. After data sources are configured, they can be used to create dashboards and visuals from your data. See Create Dashboards.
Composer Feature Support
Upload API support for specific Composer features is shown in the following table.
Key: Y - Supported; N - Not Supported; N/A - not applicable
Set Up the Upload API Data Source
Log into Composer as an administrator.
Select Sources.
Select Upload API.
Specify the name of your source and add a description (if desired).
Select
.
On the Sampling page, enter your sample data. The supported formats are CSV or JSON. You can also upload sample data from a file.
Select Preview to view your data.
Select
.
On the Fields Tab, edit the data shown for the source. For more information and steps, see Manage Data Source Configurations.
Select
.
On the Refresh page, set the refresh rates or your data. If you want to schedule a refresh of all your data, select Schedule and then selecting an option. If you only want certain fields within your data to be refreshed, select Configuration.
Use the sample cURL calls to clear previously stored data or add additional data to the source. The example cURL calls can be found on the API Endpoints page.
Select
.
On the Visuals page, you can:
Edit Global Default Settings.
Select the Standard and, if available, Custom visual styles to be used with the data source.
Set default parameters (group, sub-group, colors, sorting, and so on) for each visual style.
Select
to save your changes. After your data connection has been established, it is listed under My Data Sources.
Work with the Upload API
There are two operations that can be performed using the Upload API: appending additional data and clearing previously uploaded data. The data source wizard offers convenient example cURL requests but the APIs can be leveraged from your preferred development platform.
Remember to modify the example cURL requests to include your own Composer credentials, replacing the placeholders for username and password.
curl -v --user <username>:<password> <YourServer>
Example: Append Data
In the following example, the Upload API accepts an array of JSON objects. Note that the object field types must match those used to create the Upload API source originally. For example, if the value of the price field is a number, you can not upload new rows in which the value of the price field is a string.
curl -v --user <username>:<password> 'https://<Your_Composer_Server>/ composer/api/upload/<YourDataSourceId>' -X POST -H "Content-Type: application/vnd.composer.v2+json" -d '[{"price":100.5,"venue_id":"V678","venue_name": "Pizza Barn"}]' --insecure
Example: Clear Previously Uploaded Data
In the example below, the Upload API will clear all previously uploaded data from the data source with the ID of <YourDataSourceId>
.
curl -v --user <username>:<password> 'https://<Your_Composer_Server>/ api/upload/<YourDataSourceId>' -X DELETE --insecure
Comments
0 comments
Please sign in to leave a comment.