Manage File Uploads in Composer
Composer can visualize data from file uploads including CSV, JSON, and TSV files.
- The maximum supported file size is 500 MB
- Data from the file upload is stored in a PostgreSQL database
Before you can establish a connection from Composer to your file uploads storage, a connector server needs to be installed and configured. See Manage Connectors and Connector Servers for general instructions.
After the connector has been set up, create a data source configuration and upload your file or files to that source. See:
Upload a New File
Log in as a user with the Administer Sources or Create New Data Sources privilege.
Select Add to add a new data entity, then select From File.
Add a unique Data Entity Name, then select Upload New File. The File Upload work area opens.
Enter File Details, such as a unique Display Name, and optional Description.
Use the Browse button to select a file to upload.
After you have selected a file, Composer may autofill the Single Quote Char. and Field Delimiter fields. Adjust if needed.
If needed, change the No. of records to display from 10 to up to 1,000 records.
Enable or disable the checkbox Column Headers in first row to match your file layout. If no column headers are in your data, Composer assigns numerical column headings, field_1, field_2, and so on.
Optionally, select Preview to preview your data.
Enable or disable the checkbox Use Only File Structure to create the file using only the existing file structure, no data.
Select Save to close the File Upload work area and continue creating or updating your data entity for this source.
Edit an Existing File
Log in as a user with the Administer Sources or Create new Data Sources privilege.
Select the data entity with the file you want to edit, then select Edit File. The File Upload work area opens.
Browse for a new file.
If you are replacing the existing file, your new file must use the same data file structure as the existing file. Enable the Replace checkbox in Upload Settings: previous data is replaced.
If you are adding data to the existing file, your new file must use the same data file structure as the existing file. Disable the Replace checkbox in Upload Settings: previous data is appended with new rows of data.
Select Preview to preview your data.
The Current Data tab shows the data of your existing file.
The New Data shows the replaced or amended data preview.
Select Save to Save your changes or Cancel to discard your changes. The File Upload work area closes.
API Endpoints
Log in as a user with the Administer Sources or Create new Data Sources privilege.
Select the data entity with the file you want to edit, then select API Endpoints. The API Endpoints dialog box opens.
The dialog offers convenient example cURL requests but the APIs can be leveraged from your preferred development platform.
Copy and modify the example cURL requests to include your own Composer credentials, replacing the placeholders for username and password. Select Close to close the dialog.
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 source creation page offers convenient example cURL requests but the APIs can be leveraged from your preferred development platform. Select API Endpoints on the source creation tab to edit your data.
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.v3+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
Composer Feature Support
File Upload support for specific Composer features is shown in the following table.
Key: Y - Supported; N - Not Supported; N/A - not applicable
Comments
0 comments
Please sign in to leave a comment.