Initial commit
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
## Quickstart
|
||||
|
||||
For this example (and the rest of the ones illustrated here) we will be using a command-line tool known as `cURL`. For more info about this tool see [this blog post](http://quickleft.com/blog/command-line-tutorials-curl) or type `man curl` in bash.
|
||||
|
||||
### Uploading a Local File
|
||||
|
||||
Suppose you have a CARTO account whose username is *documentation*, and you want to upload a local file named *prism_tour.csv* (located in the *Documents* folder). This requires that you execute the following command on a Terminal window:
|
||||
|
||||
#### Call
|
||||
|
||||
```bash
|
||||
curl -v -F file=@/home/documentation/Documents/prism_tour.csv
|
||||
"https://documentation.carto.com/api/v1/imports/?api_key=3102343c42da0f1ffe6014594acea8b1c4e7fd64"
|
||||
```
|
||||
|
||||
Note that the *api_key* element has an alphanumeric value that is exclusive to the *documentation* CARTO account.
|
||||
|
||||
The response to this request appears in the following format, where a successful value indicates that the import process is enqueued:
|
||||
|
||||
#### Response
|
||||
|
||||
```
|
||||
{
|
||||
"item_queue_id": "efa9925c-31dd-11e4-a95e-0edbca4b5057",
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
The `item_queue_id` value is a unique identifier that references the import process. Once this process has started, its information can be obtained doing a request to the imports endpoint as explained in the ["Check the status of an import process]({{site.importapi_docs}}/guides/standard-tables/#check-the-status-of-an-import-process) section.
|
||||
|
||||
### Uploading from a Remote URL
|
||||
|
||||
Suppose you have a server at the hostname *examplehost.com*, with a csv named *sample.csv* already uploaded. Creating a table from the URL requires that you execute the following command on a Terminal window:
|
||||
|
||||
#### Call
|
||||
|
||||
```bash
|
||||
curl -v -H "Content-Type: application/json" -d '{"url":"https://examplehost.com/sample.csv"}'
|
||||
"https://documentation.carto.com/api/v1/imports/?api_key=3102343c42da0f1ffe6014594acea8b1c4e7fd64"
|
||||
```
|
||||
|
||||
The response to this request returns the following format, returning a success value if the import process is correctly enqueued:
|
||||
|
||||
#### Response
|
||||
|
||||
```
|
||||
{
|
||||
"item_queue_id": "efa9925c-31dd-11e4-a95e-0edbca4b5057",
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
### Connecting to a Database
|
||||
|
||||
Suppose you have an external MySQL database named _mydb_ that you want to connect to. For the purpose of this example, you will access a server with the address of _mydbserver.com_. Your username is _myuser_, and your password is _mypass_. Connect a CARTO dataset to a remote table, named _mytable_, by executing the following command on a Terminal window:
|
||||
|
||||
#### Call
|
||||
|
||||
```bash
|
||||
curl -v -H "Content-Type: application/json" -d '{
|
||||
"connector": {
|
||||
"provider": "mysql",
|
||||
"connection": {
|
||||
"server":"mydatabaserver.com",
|
||||
"database":"mydb",
|
||||
"username":"myuser,
|
||||
"password":"mypass"
|
||||
},
|
||||
"table": "mytable"
|
||||
}
|
||||
}' "https://documentation.carto.com/api/v1/imports/?api_key=3102343c42da0f1ffe6014594acea8b1c4e7fd64"
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```
|
||||
{
|
||||
"item_queue_id": "tyf9925c-32dd-11f4-a95f-0fdbca4b5058",
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,33 @@
|
||||
## General Concepts
|
||||
|
||||
The following concepts are the same for every endpoint in the API except when it is noted explicitly.
|
||||
|
||||
|
||||
### Auth
|
||||
|
||||
Manipulating data on a CARTO account requires prior authentication using a unique identifier as a password. For the import API, a special identifier known as the API Key is used as a proof of authentication for each user account to authorize access to its data.
|
||||
|
||||
To execute an authorized request, `api_key=YOURAPIKEY` should be added to the request URL. This parameter can be also passed as a POST parameter. We **strongly advise** using HTTPS when you are performing requests that include your `api_key`.
|
||||
|
||||
---
|
||||
|
||||
### Errors
|
||||
|
||||
Errors are reported using standard HTTP codes and extended information encoded in the HTML language, as shown in the following example:
|
||||
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<title>411 Length Required</title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<center>
|
||||
<h1>411 Length Required</h1>
|
||||
</center>
|
||||
<hr>
|
||||
<center>nginx</center>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
Depending on the specific case, additional information regarding the error may be presented. See support section for details about known error codes and solutions.
|
||||
@@ -0,0 +1,212 @@
|
||||
## Standard Tables
|
||||
|
||||
A standard import stores the data you upload from files with valid formats, creating tables at CARTO. These are the default tables used to store the data of the uploaded files (that will be used to create datasets and maps). Any CARTO user may create, manipulate, and delete their own datasets.
|
||||
|
||||
### Upload file
|
||||
|
||||
##### Definition
|
||||
|
||||
```bash
|
||||
POST api/v1/imports
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The target CARTO account API key.
|
||||
file | When importing local files, you need to perform a POST with a file (see the call with cURL example in this section).
|
||||
url | When importing remote files, the full URL to the publicly accessible file.
|
||||
type_guessing | If set to `false` disables field type guessing (for Excel and CSVs). Optional. Default is `true`.
|
||||
quoted_fields_guessing | If set to `false` disables type guessing of CSV fields that come inside double quotes. Optional. Default is `true`.
|
||||
content_guessing | Set to `true` to enable content guessing and automatic geocoding based on results. Currently, this only implements geocoding of countries, cities and IP addresses. Optional. Default is `false`.
|
||||
create_vis | Set to `true` to flag the import so that when it finishes, it creates a Map automatically after importing the Dataset. Optional. Default is `false`.
|
||||
collision_strategy | Determines the behavior when importing a dataset that has the same name as an existing table. By default, it is imported and renamed with a sequential number (`mytable`, `mytable_1`...). Optional. If you set `collision_strategy=skip`, the table with the matching name will not be imported. If you set `collision_strategy=overwrite`, it will replace the table with the matching name, but only if the schemas are compatible.
|
||||
privacy | Used to set the privacy settings of the table or tables resulting from the import. If **create_vis** is set to true, the resulting visualization privacy settings will also be determined by this parameter. **privacy** can be set to:
|
||||
--- | ---
|
||||
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> public | The resulting table or visualization can be viewed by anyone.
|
||||
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> private | The resulting table or visualization can only be viewed by the uploader.
|
||||
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> link | The resulting table or visualization can only be viewed through a private link shared by the uploader.
|
||||
table_name | Used to duplicate one of your existing tables. **Do not mix with File/URL imports**.
|
||||
table_copy | Similar to *table_name*, internally used for table copying. **Do not set**.
|
||||
table_id | Internal usage for table migrations. **Do not set**.
|
||||
append | Reserved for future usage. **Do not set**.
|
||||
sql | Used to create a new table from a SQL query applied to one of your tables. **Do not mix with File/URL imports**.
|
||||
service_name | Used to upload from datasources, indicates which datasource to use. Check [here](https://github.com/CartoDB/cartodb/tree/master/services/datasources/lib/datasources) for an updated list of available datasources to use. **Intended for CARTO Builder usage**.
|
||||
service_item_id | Used to upload from datasources and indicates data of the datasource. Check [here](https://github.com/CartoDB/cartodb/tree/master/services/datasources/lib/datasources) for an updated list of available datasources to use. **Intended for CARTO Builder usage**.
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
item_queue_id | A unique alphanumeric identifier referencing the import process in the targeted account.
|
||||
success | A boolean value indicating whether the import process was started or not.
|
||||
|
||||
#### Local File Upload Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -F file=@/path/to/local/file "https://{account}.carto.com/api/v1/imports/?api_key={account API Key}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
"item_queue_id": "9906bce0-f1a3-4b07-be71-818f4bfd7673",
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
#### URL Upload Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -H "Content-Type: application/json" -d '{"url":"https://remotehost.url/path/to/remotefile"}'
|
||||
"https://{account}.carto.com/api/v1/imports/?api_key={account API Key}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
"item_queue_id": "9906bce0-f1a3-4b07-be71-818f4bfd7673",
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Check the status of an import process
|
||||
|
||||
When uploading a file for import, it may take some time due to the file's size and the additional processing on the CARTO side. Using this request, an import process state can be retrieved.
|
||||
|
||||
##### Definition
|
||||
|
||||
```bash
|
||||
GET /api/v1/imports/<import_id>
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The target CARTO account API key.
|
||||
The import identifer | A unique alphanumeric element that identifies the import process to be retrieved. It is the *item_queue_id* element returned after running the upload request successfully.
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes the following items:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
id | A unique identifier for the import process. It is the same as the *import id* provided in the request.
|
||||
user_id | A unique alphanumeric element that identifies the CARTO account user in the internal database.
|
||||
table_id | A unique alphanumeric element that identifies the created table in the internal CARTO database.
|
||||
data_type | This element identifies the service type used to import the file. Possible values are `file`, `url`, `external_table`, `query`, `table` or `datasource`.
|
||||
table_name | The final name of the created table in the targeted CARTO account. It usually has the same name as the uploaded file, unless there already exists a table with the same name (in this case, an integer number is appended to the table name).
|
||||
state | A string value indicating the current state of the importing process. It can have any of the following values: *enqueued*, *pending*, *uploading*, *unpacking*, *importing*, *guessing*, *complete*, or *failure*.
|
||||
error_code | A number corresponding to the error code in case of failure during the import process, that is, when the *success* item has a *false* value.
|
||||
queue_id | A unique identifier for the import process in the importing queue. It is the same as the *import id* provided in the request.
|
||||
tables_created_count | The number of tables that the import process generated. For multi-file uploads, this value can be greater than one. If the import process fails, its value will be `null`.
|
||||
synchronization_id | This element has a *null* value when the import is not configured as a Sync Table.
|
||||
type_guessing | A boolean indicating whether field type guessing (for Excel and CSVs) is enabled or not.
|
||||
quoted_fields_guessing | A boolean indicating whether type guessing of CSV fields inside double quotes is enabled for the data import.
|
||||
content_guessing | A boolean indicating whether content guessing and automatic geocoding is enabled for the data import.
|
||||
create_visualization | A boolean indicating whether the import process will create a map automatically or not. Its value corresponds to the import option `create_vis` chosen by the user.
|
||||
visualization_id | A unique identifier for the map created in the import process. Only applies if `create_visualization` is set to `true`.
|
||||
user_defined_limits | Internal usage for user limits.
|
||||
get_error_text | This element contains an error description to be outputted in case of a failure during the import process. It contains the error title and description, its source (`user` or `cartodb`), and troubleshooting details.
|
||||
display_name | Similar to `table_name`. For `url` uploads, it shows the name of the file. Otherwise, it shows the import id.
|
||||
success | A boolean value indicating whether the import process succeeded (*true* or *false*).
|
||||
warnings | A text field containing warning messages related to the import process, if applicable.
|
||||
is_raster | A boolean value indicating whether the imported table contains raster data or not.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v "https://{account}.carto.com/api/v1/imports/{import_id}?api_key={account API Key}
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
id: "029a6053-b2fb-43dd-baa6-805d679c404f",
|
||||
user_id: "ca8c5ace-d573-450b-8a43-6c7eafadd80e",
|
||||
table_id: null,
|
||||
data_type: "url",
|
||||
table_name: null,
|
||||
state: "failure",
|
||||
error_code: 1002,
|
||||
queue_id: "029a6053-b2fb-43dd-baa6-805d679c404f",
|
||||
tables_created_count: null,
|
||||
synchronization_id: null,
|
||||
type_guessing: true,
|
||||
quoted_fields_guessing: true,
|
||||
content_guessing: false,
|
||||
create_visualization: false,
|
||||
visualization_id: null,
|
||||
user_defined_limits: "{"twitter_credits_limit":0}",
|
||||
get_error_text: {
|
||||
title: "Unsupported/Unrecognized file type",
|
||||
what_about: "Should we support this filetype? Let us know in our <a href='mailto:support@carto.com'>support email</a>!",
|
||||
source: "user"
|
||||
},
|
||||
display_name: "shapefile_streets.cpg",
|
||||
success: false,
|
||||
warnings: null,
|
||||
is_raster: false
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Retrieving a list of all the current import processes
|
||||
|
||||
Lists the import identifiers of the files that are being imported in the targeted CARTO account.
|
||||
|
||||
##### Definition
|
||||
|
||||
```bash
|
||||
GET /api/v1/imports/
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The target CARTO account API key.
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
imports | A list of unique alphanumeric identifiers referencing the import processes in the targeted CARTO account.
|
||||
success | A boolean value indicating if the request was successful.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v "https://{account}.carto.com/api/v1/imports/?api_key={account API Key}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
"imports": [
|
||||
"1234abcd-1234-1a2b-3c4d-4321dcba5678"
|
||||
],
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,74 @@
|
||||
## CARTO Map Visualizations
|
||||
|
||||
The *Export map* option enables you to download a map, and the connected dataset, as a .carto file. This is useful for downloading complete CARTO visualizations that you can share or import.
|
||||
|
||||
**Note:** The Import API export visualization command only works for maps created from your dashboard.
|
||||
|
||||
A cURL POST request allows you to export the visualization, which you will have to poll with a GET command until the state is `complete`.
|
||||
|
||||
### Export a CARTO Visualization
|
||||
|
||||
#### Call
|
||||
|
||||
```bash
|
||||
curl -H 'Content-Type: application/json' https://{username}.carto.com/api/v3/visualization_exports\?api_key\={api_key} -X POST --data '{"visualization_id":"{visualization_id}"}'
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The target CARTO account API key.
|
||||
visualization_id | A unique identifier for the map created in the export process. Only applies if `create_visualization` is set to true when the map was created.
|
||||
|
||||
#### Response
|
||||
|
||||
```
|
||||
{"id":"b94c26f3-fa16-4f13-b672-45ebbd5a9c95","visualization_id":"ace62506-brc8-6570-2p91-8vf3af3ftc44","user_id":"42b78090-6a11-475a-8060-0a90322752af2","state":"pending","url":null,"created_at":"2016-05-05T09:36:09+00:00","updated_at":"2016-05-05T09:36:09+00:00"}
|
||||
```
|
||||
|
||||
_After making the POST request to create the export, it is expected that the request will take some time. You must poll the server by making a GET request, until state becomes complete._ For example:
|
||||
|
||||
```
|
||||
curl -v -H 'Content-Type: application/json' https://{username}.carto.com/api/v3/visualization_exports/{visualization_export_id}\?api_key\={api_key} -X GET
|
||||
```
|
||||
|
||||
Once completed, the response status changes to `complete` and displays the upload url location of the .carto visualization file:
|
||||
|
||||
```
|
||||
{"id":"b94c26f3-fa16-4f13-b672-45ebbd5a9c95","visualization_id":"{visualization_id}","user_id":"42b78090-6a11-475a-8060-0a90322752af2","state":"complete","url":"/uploads/6a2b6fbd86e2c750160a/ace62506-brc8-6570-2p91-8vf3af3ftc44.carto","created_at":"2016-05-05T09:36:09+00:00","updated_at":"2016-05-05T09:36:13+00:00"}%
|
||||
```
|
||||
|
||||
The response includes:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
id | A unique identifier for the export process. It is the same as the _export id_ provided in the request.
|
||||
vizualization_id | A unique identifier for the map created in the export process. Only applies if `create_visualization` is set to true when the map was created.
|
||||
user_id | A unique alphanumeric element that identifies the CARTO account user in the internal database.
|
||||
state | A string value indicating the current state of the export process. It can have any of the following values: _enqueued, pending, uploading, unpacking, importing, guessing, complete_, or _failure_.
|
||||
url | The **public** URL address where the file to be exported is located.
|
||||
created_at | The date time at which the visualization was created in the CARTO database.
|
||||
updated_at | The date time at which the visualization had its contents modified.
|
||||
|
||||
##### Example
|
||||
|
||||
Example POST request:
|
||||
|
||||
```
|
||||
curl -v -H 'Content-Type: application/json' https://{username}.carto.com/api/v3/visualization_exports\?api_key\={api_key} -X POST --data '{"visualization_id":"9a0f4384-afe3-412a-8b09-136b7d9a4013"}'
|
||||
{"id":"72e488a6-cf0e-404d-bc7e-de9c9840aadf","visualization_id":"9a0f4384-afe3-412a-8b09-136b7d9a4013","user_id":"d80fe0f5-0465-4c4a-a2fe-1f14a93f3c5b","state":"pending","url":null,"created_at":"2016-05-20T07:01:38+00:00","updated_at":"2016-05-20T07:01:38+00:00"}%
|
||||
```
|
||||
|
||||
Example completed response:
|
||||
|
||||
```
|
||||
curl -H 'Content-Type: application/json' https://{username}.carto.com/api/v3/visualization_exports/72e488a6-cf0e-404d-bc7e-de9c9840aadf\?api_key\=04039a13c1bdda65df8bd825b3b8e8117444c950 -X GET
|
||||
{"id":"72e488a6-cf0e-404d-bc7e-de9c9840aadf","visualization_id":"9a0f4384-afe3-412a-8b09-136b7d9a4013","user_id":"d80fe0f5-0465-4c4a-a2fe-1f14a93f3c5b","state":"complete","url":"http://s3.amazonaws.com/com.cartodb.imports.production/9d149e72331bf074e35f/9a0f4384-afe3-412a-8b09-136b7d9a4013.carto?AWSAccessKeyId=AKIAJK5S64CVBE35QTKA&Expires=1463734900&Signature=b4cwrdoB%2B0FlTelIzNOAgslUDXY%3D","created_at":"2016-05-20T07:01:38+00:00","updated_at":"2016-05-20T07:01:40+00:00"}%
|
||||
```
|
||||
|
||||
### Import a CARTO Visualization
|
||||
|
||||
To import a .carto visualization, you can use the standard Import API procedure for uploading a local file.
|
||||
|
||||
See the import errors list on Support section to troubleshoot any importing errors.
|
||||
@@ -0,0 +1,311 @@
|
||||
## Sync Tables
|
||||
|
||||
Sync tables are available for certain CARTO plans. These tables store data from a remote file and refresh their contents during periodic intervals specified by the user. The base files from which the sync tables retrieve their contents may come from Google Drive, Dropbox, Box or a public URL.
|
||||
|
||||
### Upload and manage synced tables
|
||||
|
||||
##### Definition
|
||||
|
||||
```html
|
||||
GET /api/v1/synchronizations
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The target CARTO account API key.
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes an **array** of items, each one containing the following elements:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
id | A unique alphanumeric identifier of the synced table.
|
||||
name | The actual name of the created sync table.
|
||||
interval | An integer value representing the number of seconds between synchronizations of the table contents.
|
||||
url | The **public** URL address where the file to be synchronized is located.
|
||||
state | A string value indicating the current state of the synchronized dataset. It can have any of the following values: **created**, **queued**, **syncing**, **success** or **failure**.
|
||||
created_at | The date time at which the table was created in the CARTO database.
|
||||
updated_at | The date time at which the table had its contents modified.
|
||||
run_at | The date time at which the table will get its contents synched with the source file.
|
||||
retried_times | An integer value indicating the number of attempts that were performed to sync the table.
|
||||
log_id | A unique alphanumeric identifier to locate the log traces of the given table.
|
||||
error_code | An integer value representing a unique error identifier.
|
||||
error_message | A string value indicating the message related to the *error_code* element.
|
||||
ran_at | The date time at which the table **had** its contents synched with the source file.
|
||||
modified_at | The date time at which the table was manually modified, if applicable.
|
||||
etag | HTTP entity tag of the source file.
|
||||
checksum | See **etag**.
|
||||
user_id | A unique alphanumeric element that identifies the CARTO account user in the internal database.
|
||||
service_name | A string with the name of the datasource used to import the file. It can have any of the following values: *gdrive* for Google Drive, *dropbox* for Dropbox and *null* for URL imports.
|
||||
|
||||
service_item_id | A unique identifier used by CARTO to reference the sync table and its related datasource service.
|
||||
type_guessing | A boolean indicating whether field type guessing (for Excel and CSVs) is enabled or not.
|
||||
quoted_fields_guessing | A boolean indicating whether type guessing of CSV fields inside double quotes is enabled for the data import.
|
||||
content_guessing | A boolean indicating whether content guessing and automatic geocoding is enabled for the data import.
|
||||
visualization_id | A unique identifier for the map created in the import process. Only applies if `create_visualization` is set to true.
|
||||
from_external_source | A boolean indicating whether the Sync Table is connected to an external source, generally the CARTO Data library.
|
||||
|
||||
Finally, the array includes a **total_entries** element that indicates the number of items contained in the response array.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v "https://{username}.carto.com/api/v1/synchronizations/?api_key={account API Key}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```javascript
|
||||
{
|
||||
"synchronizations": [
|
||||
{
|
||||
"id": "246dae5e-5302-1ae5-af51-0e85ad047bba",
|
||||
"name": "barrios_5",
|
||||
"interval": 2592000,
|
||||
"url": "https://common-data.carto.com/api/v2/sql?q=select+*+from+%22barrios%22&format=shp&filename=barrios",
|
||||
"state": "success",
|
||||
"created_at": "2015-09-04T12:40:37+00:00",
|
||||
"updated_at": "2016-02-01T12:45:07+00:00",
|
||||
"run_at": "2016-03-02T12:45:07+00:00",
|
||||
"retried_times": 0,
|
||||
"log_id": "2d9b4a52-1daa-429b-b425-6ad561609cb1",
|
||||
"error_code": null,
|
||||
"error_message": null,
|
||||
"ran_at": "2016-02-01T12:45:07+00:00",
|
||||
"modified_at": "2015-04-22T12:17:50+00:00",
|
||||
"etag": null,
|
||||
"checksum": null,
|
||||
"user_id": "cf8a5cce-d573-4a0b-8c43-6caeaf1dd80e",
|
||||
"service_name": null,
|
||||
"service_item_id": "https://common-data.carto.com/api/v2/sql?q=select+*+from+%22barrios%22&format=shp&filename=barrios",
|
||||
"type_guessing": true,
|
||||
"quoted_fields_guessing": true,
|
||||
"content_guessing": true,
|
||||
"visualization_id": "2954fa60-5a02-11e5-888a-0e5e07bb5d8a",
|
||||
"from_external_source": false
|
||||
}
|
||||
],
|
||||
"total_entries": 1
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Syncing a file from a URL
|
||||
|
||||
##### Definition
|
||||
|
||||
```html
|
||||
POST /api/v1/synchronizations
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The targeted CARTO account API key.
|
||||
url | The **public** URL address where the file to be imported is located.
|
||||
interval | The number of seconds for the synchronization period. *Note*: Sync interval must be at least 900 (15 minutes).
|
||||
type_guessing | If set to *false* disables field type guessing (for Excel and CSVs). Optional. Default is *true*.
|
||||
quoted_fields_guessing | If set to *false* disables type guessing of CSV fields that come inside double quotes. Optional. Default is *true*.
|
||||
content_guessing | Set it to *true* to enable content guessing and automatic geocoding based on results. Currently it only implements geocoding of countries. Optional. Default is *false*.
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes the following items:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
endpoint | This item refers to the internal CARTO controller code responsible for performing the import.
|
||||
item_queue_id | A unique alphanumeric identifier that refers to the import process. It can be used to retrieve data related to the created table.
|
||||
id | An alphanumeric identifier used internally by CARTO as a reference to the import process.
|
||||
name | This item is currently deprecated.
|
||||
interval | An integer value that stores the number of seconds between synchronizations.
|
||||
state | A string value indicating the current condition of the importing process. It can have any of the following values: **created**, **queued**, **syncing**, **success** or **failure**.
|
||||
user_id | A unique alphanumeric identifier to reference the user in the CARTO Engine.
|
||||
created_at | The date time at which the table was created in the CARTO Engine.
|
||||
updated_at | The date time at which the table had its contents modified.
|
||||
run_at | The date time at which the table will get its contents synched with the source file.
|
||||
ran_at | The date time at which the table **had** its contents synched with the source file.
|
||||
modified_at | The date time at which the table was manually modified, if applicable.
|
||||
etag | HTTP entity tag of the source file.
|
||||
checksum | See **etag**.
|
||||
log_id | A unique alphanumeric identifier to locate the log traces of the given table.
|
||||
error_code | An integer value representing a unique error identifier.
|
||||
error_message | A string value indicating the message related to the *error_code* element.
|
||||
retried_times | An integer value indicating the number of attempts that were performed to sync the table.
|
||||
service_name | A string with the name of the datasource used to import the file. It can have any of the following values: *gdrive* for Google Drive, *dropbox* for Dropbox and *null* for URL imports.
|
||||
|
||||
service_item_id | A unique identifier used by CARTO to reference the sync table and its related datasource service.
|
||||
type_guessing | A boolean indicating whether field type guessing (for Excel and CSVs) is enabled or not.
|
||||
quoted_fields_guessing | A boolean indicating whether type guessing of CSV fields inside double quotes is enabled for the data import.
|
||||
content_guessing | A boolean indicating whether content guessing and automatic geocoding is enabled for the data import.
|
||||
visualization_id | A unique identifier for the map created in the import process. Only applies if `create_visualization` is set to true.
|
||||
from_external_source | A boolean indicating whether the Sync Table is connected to an external source, generally the CARTO Common-Data library.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -H "Content-Type: application/json" -d '{"url":"https://public.url.to.file/sample_file", "interval":"3600"}' "https://{username}.carto.com/api/v1/synchronizations/?api_key={account API Key}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
"data_import": {
|
||||
"endpoint": "/api/v1/imports",
|
||||
"item_queue_id": "1234abcd-1234-1a2b-3c4d-4321dcba5678"
|
||||
},
|
||||
"id": "abcd1234-a5b6-c7d8-1a2b-efgh5678abcd",
|
||||
"name": null,
|
||||
"interval": 3600,
|
||||
"url": "https://public.url.to.file/sample_file",
|
||||
"state": "created",
|
||||
"user_id": "aaaabbbb-1234-5678-dcba-abcd1234efgh",
|
||||
"created_at": "2014-08-05T13:39:15+00:00",
|
||||
"updated_at": "2014-08-05T13:39:15+00:00",
|
||||
"run_at": "2014-08-05T14:39:15+00:00",
|
||||
"ran_at": "2014-08-05T13:39:15+00:00",
|
||||
"modified_at": null,
|
||||
"etag": null,
|
||||
"checksum": "",
|
||||
"log_id": "06fafab8-3502-11e4-9514-0e230854a1cb",
|
||||
"error_code": null,
|
||||
"error_message": null,
|
||||
"retried_times": 0,
|
||||
"service_name": null,
|
||||
"service_item_id": null,
|
||||
"type_guessing": true,
|
||||
"quoted_fields_guessing": true,
|
||||
"content_guessing": false,
|
||||
"visualization_id": null,
|
||||
"from_external_source": false
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Removing the synchronization feature from a given dataset
|
||||
|
||||
A sync table can be converted to a standard dataset (a dataset that never gets synced).
|
||||
|
||||
##### Definition
|
||||
|
||||
```bash
|
||||
DELETE /api/v1/synchronizations/<import_id>
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The target CARTO account API key.
|
||||
Target table import id | The unique alphanumeric identifier of the target sync dataset.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -X "DELETE" https://{username}.carto.com/api/v1/synchronizations/{import_id}?api_key={account API Key}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
An HTTP No content - 204 response should result as a confirmation for the removal of the synchronization feature for the target table.
|
||||
|
||||
---
|
||||
|
||||
### Check whether a sync table is syncing or not
|
||||
|
||||
A large synced table may take some time to get fully synced. In the meantime, it could be useful to check whether it finished refreshing its contents.
|
||||
|
||||
##### Definition
|
||||
|
||||
```bash
|
||||
GET /api/v1/synchronizations/<import_id>/sync_now
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The target CARTO account API key.
|
||||
Target table import id | The unique alphanumeric identifier of the target sync table.
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes the following items:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
state | A string value indicating the status of the synchronization. It can have any of the following values: **created**, **queued**, **syncing**, **success** or **failure**.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -X "GET" "https://{username}.carto.com/api/v1/synchronizations/{import_id}/sync_now?api_key={account API Key}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
"state": "syncing"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Force a synchronization action on a sync table
|
||||
|
||||
Sync tables have their contents synchronized with the source file in periodic time intervals as specified by the user during the creation process. However, a dataset can be synchronized at an arbitrary moment in time if desired. **Note**: Forcing a synchronization can only be performed when the last synchronization attempt occurred at least 900 seconds (15 minutes) before.
|
||||
|
||||
#### Definition
|
||||
|
||||
```bash
|
||||
PUT /api/v1/synchronizations/<import_id>/sync_now
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
api_key | The target CARTO account API key.
|
||||
Target table import id | The unique alphanumeric identifier of the target sync table.
|
||||
|
||||
#### Response
|
||||
|
||||
The response includes the following items:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
enqueued | A boolean value indicating whether the request has been successfully appended to the processing queue.
|
||||
synchronization_id | A unique alphanumeric identifier referring to the queue element just added.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -X "PUT" "https://{username}.carto.com/api/v1/synchronizations/<import_id>/sync_now?api_key={account API Key}" -H "Content-Length:0"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```bash
|
||||
{
|
||||
"enqueued": true,
|
||||
"synchronization_id": "1234abcd-aaaa-2222-4444-dcba4321a1b2"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,221 @@
|
||||
## Importing an ArcGIS™ Layer
|
||||
|
||||
The ArcGIS™ Connector allows you to import ArcGIS™ layers into a CARTO account as dataset from ArcGIS Server™ (version 10.1 or higher is required). Note that **this connector is disabled by default** in the CARTO importer options. If you are interested in enabling it, please contact [support@carto.com](mailto:support@carto.com) for more details.
|
||||
|
||||
**Tip:** You can easily import ArcGIS™ server table URLs from CARTO Builder, with the ArcGIS Server™ Connect Dataset option.
|
||||
|
||||
### Import an ArcGIS™ Layer
|
||||
|
||||
ArcGIS™ layers stored in ArcGIS Server™ can get imported as CARTO datasets. Such layers must be (PUBLIC) and accessible via an **ArcGIS™ API REST URL**, using the following structure:
|
||||
|
||||
```html
|
||||
http://<host>/<site>/rest/services/<folder>/<serviceName>/<serviceType>/<layer_ID>
|
||||
```
|
||||
|
||||
##### Definition
|
||||
|
||||
```bash
|
||||
POST api/v1/imports
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
interval | This value **MUST** be set to *0*. **Different values do not guarantee correct imports**.
|
||||
service_item_id | The ArcGIS™ API REST URL where the ArcGIS™ layer is located.
|
||||
service_name | This value **MUST** be set to *arcgis* to make use of this connector.
|
||||
value | Same URL as specified in the *service_item_id* parameter.
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
item_queue_id | A unique alphanumeric identifier referencing the imported file in the targeted account.
|
||||
success | A boolean value indicating whether the import process was successfully appended to the processing queue or not.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -H "Content-Type: application/json" -d '{"interval":"0","service_item_id": "http://url.to.arcgis.server.layer", "service_name": "arcgis", "value": "http://url.to.arcgis.server.layer"}' "https://{username}.carto.com/api/v1/imports/?api_key={API_KEY}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
"item_queue_id": "d676fd50-b774-4052-a4f1-e56ac6a4300e",
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
### Syncing an ArcGIS™ Layer
|
||||
|
||||
An ArcGIS™ layer can get imported to a CARTO account as a synchronized table. The target ArcGIS™ layer must be (PUBLIC) and accessible via an ArcGIS™ API REST URL, using the following structure:
|
||||
```html
|
||||
http://<host>/<site>/rest/services/<folder>/<serviceName>/<serviceType>/<layer_ID>
|
||||
```
|
||||
|
||||
##### Definition
|
||||
|
||||
```bash
|
||||
POST /api/v1/synchronizations
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
interval | The number of seconds for the synchronization period. *Note*: Sync interval must be at least 900 (15 minutes).
|
||||
service_item_id | The ArcGIS™ API REST URL where the ArcGIS™ dataset is located. **Note:** Layers and Datasets must be (PUBLIC) and accessible via an ArcGIS™ API REST URL. You cannot enforce ArcGIS Server security parameters into the request, the REST endpoints must be publicly available.
|
||||
service_name | This value **MUST** be set to *arcgis* to make use of this connector.
|
||||
url | This value **MUST** be empty.
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes the following items:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
endpoint | This item refers to the internal CARTO controller code responsible for performing the import.<br/><br/>
|
||||
item_queue_id | A unique alphanumeric identifier that refers to the import process. It can be used to retrieve data related to the created dataset.
|
||||
id | An alphanumeric identifier used internally by CARTO as a reference to the import process.
|
||||
name | This item is currently deprecated.
|
||||
interval | An integer value that stores the number of seconds between synchronizations.
|
||||
url | This value is empty in this case.
|
||||
state | A string value indicating the current condition of the importing process. It can have any of the following values: **created**, **queued**, **syncing**, **success** or **failure**.
|
||||
user_id | A unique alphanumeric identifier to reference the user in the CARTO Engine.
|
||||
created_at | The date time at which the dataset was created in the CARTO Engine.
|
||||
updated_at | The date time at which the dataset had its contents modified.
|
||||
run_at | The date time at which the table will get its contents synced with the source file.
|
||||
ran_at | The date time at which the table **had** its contents synced with the source file.
|
||||
modified_at | The date time at which the dataset was manually modified, if applicable.
|
||||
etag | HTTP entity tag of the source file.
|
||||
checksum | See **etag**.
|
||||
log_id | A unique alphanumeric identifier to locate the log traces of the given dataset.
|
||||
error_code | An integer value representing a unique error identifier.
|
||||
error_message | A string value indicating the message related to the *error_code* element.
|
||||
retried_times | An integer value indicating the number of attempts that were performed to sync the table.
|
||||
service_name | This value is set to *arcgis*.
|
||||
service_item_id | This item contains the ArcGIS™ API REST URL targeting the imported ArcGIS™ layer.
|
||||
type_guessing | A boolean indicating whether field type guessing (for Excel and CSVs) is enabled or not.
|
||||
quoted_fields_guessing | A boolean indicating whether type guessing of CSV fields inside double quotes is enabled for the data import.
|
||||
content_guessing | A boolean indicating whether content guessing and automatic geocoding is enabled for the data import.
|
||||
visualization_id | A unique identifier for the map created in the import process. Only applies if `create_visualization` is set to true.
|
||||
from_external_source | A boolean indicating whether the Sync Table is connected to an external source, generally the CARTO Common-Data library.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -H "Content-Type: application/json" -d '{"interval":"604800","service_item_id": "http://url.to.arcgis.server.layer", "service_name": "arcgis", "url":""}' "https://{username}.carto.com/api/v1/synchronizations?api_key={API_KEY}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
"endpoint":"/api/v1/imports",
|
||||
"item_queue_id":"4ff4abdd-9d37-4b7a-8e13-fb00376e2a58",
|
||||
"id":"d4bc05e8-5063-11e4-9886-0e018d66dc29",
|
||||
"name":null,
|
||||
"interval":604800,
|
||||
"url":"",
|
||||
"state":"created",
|
||||
"user_id":"4884b545-07f4-4ce4-a62f-fe9e2412098f",
|
||||
"created_at":"2014-10-10T09:57:22+00:00",
|
||||
"updated_at":"2014-10-10T09:57:22+00:00",
|
||||
"run_at":"2014-10-17T09:57:22+00:00",
|
||||
"ran_at":"2014-10-10T09:57:22+00:00",
|
||||
"modified_at":null,
|
||||
"etag":null,
|
||||
"checksum":"",
|
||||
"log_id":"6aa19bf6-42db-477a-9b69-2c4f74fd8c31",
|
||||
"error_code":null,
|
||||
"error_message":null,
|
||||
"retried_times":0,
|
||||
"service_name":"arcgis",
|
||||
"service_item_id":"http://url.to.arcgis.layer",
|
||||
"type_guessing": true,
|
||||
"quoted_fields_guessing": true,
|
||||
"content_guessing": true,
|
||||
"visualization_id": "2954fa60-5a02-11e5-888a-0e5e07bb5d8a",
|
||||
"from_external_source": false
|
||||
}
|
||||
```
|
||||
|
||||
### Import an ArcGIS™ Dataset
|
||||
|
||||
This option allows you to programmatically import a complete set of layers belonging to an ArcGIS™ dataset (as opposed to using CARTO Builder ArcGIS Server™ Connect Dataset option). Such a dataset must be (PUBLIC) and accessible via an ArcGIS™ API REST URL, using the following structure:
|
||||
|
||||
```html
|
||||
http://<host>/<site>/rest/services/<folder>/<serviceName>/<serviceType>/
|
||||
```
|
||||
|
||||
##### Definition
|
||||
|
||||
```bash
|
||||
POST api/v1/imports
|
||||
```
|
||||
|
||||
##### Params
|
||||
|
||||
Param | Description
|
||||
--- | ---
|
||||
interval | This value **MUST** be set to *0*. **Different values do not guarantee correct imports**.
|
||||
service_item_id | The ArcGIS™ API REST URL where the ArcGIS™ dataset is located.
|
||||
service_name | This value **MUST** be set to *arcgis* to make use of this connector.
|
||||
value | Same URL as specified in the *service_item_id* parameter
|
||||
|
||||
##### Response
|
||||
|
||||
The response includes:
|
||||
|
||||
Attributes | Description
|
||||
--- | ---
|
||||
item_queue_id | A unique alphanumeric identifier referencing the imported file in the targeted account.
|
||||
success | A boolean value indicating whether the file import succeeded or not.
|
||||
|
||||
#### Example
|
||||
|
||||
##### Call
|
||||
|
||||
```bash
|
||||
curl -v -H "Content-Type: application/json" -d '{"interval":"0","service_item_id": "http://url.to.arcgis.server.dataset", "service_name": "arcgis", "value": "http://url.to.arcgis.server.dataset"}' "https://{username}.carto.com/api/v1/imports/?api_key={API_KEY}"
|
||||
```
|
||||
|
||||
##### Response
|
||||
|
||||
```
|
||||
{
|
||||
"item_queue_id": "c478fd50-f984-4091-d1f2-e72ac6c4333e",
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
### Limits
|
||||
|
||||
Connections to ArcGIS™ server are limited by two types of timeouts: connection and response timeouts.
|
||||
|
||||
#### Connection timeout
|
||||
|
||||
Connection timeout to the ArcGIS™ server is set to 60 seconds.
|
||||
|
||||
This means if the ArcGIS™ server does not respond to a request in 60 seconds the connection is closed and the synchronization of the dataset will fail.
|
||||
|
||||
In the vast majority of cases a connection timeout means there's something wrong in the ArcGIS™ server, so you should contact the server administrator for more details about the issue.
|
||||
|
||||
#### Response timeout
|
||||
|
||||
Response timeout from the ArcGIS™ server is set to 60 seconds.
|
||||
|
||||
This means the ArcGIS™ server did not finish the request in 60 seconds, after the connection was made, so the resulting dataset will be incomplete and the import will fail with a `Download timeout` error code.
|
||||
|
||||
Response timeouts can happen for a number of reasons, the more commons ones are because the ArcGIS™ server is overloaded and is not able to respond in a timely manner or the dataset is too big to be transferred in 60 seconds from the server to CARTO.
|
||||
|
||||
In any case, we recommend you to first check any issue with the ArcGIS™ server administrator and if that does not solve the issue contact us at [support@carto.com](mailto:support@carto.com) for more details.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,199 @@
|
||||
## Importing Geospatial Data
|
||||
|
||||
This section explains how importing a dataset creates columns in CARTO (and the naming conventions that you should use). It includes how CARTO guesses content during the import process, lists the supported geospatial formats for uploading data, and describes how to upload multilayer datasets or batch file uploads.
|
||||
|
||||
### Dataset Basics
|
||||
|
||||
When a file is imported, it is transformed into a dataset that can be processed by CARTO. The system automatically creates the following columns:
|
||||
|
||||
* **cartodb_id**
|
||||
* This column is used as the primary key of the table
|
||||
* Its values must be integers, non-null, and unique
|
||||
* **the_geom**
|
||||
* This column stores the main geometric features of a dataset in the EPSG 4326 projection
|
||||
* **the_geom_webmercator**
|
||||
* This column stores the geometries transformed into the EPSG 3857 projection, and is used for rendering purposes
|
||||
* **_feature_count**
|
||||
* This column is automatically created when overview representations of data are created (for datasets containing more than 500,000 points).
|
||||
|
||||
When a dataset is exported from CARTO, it includes the `cartodb_id` and `the_geom` columns, which will be reused if the dataset is then imported to the system. This ensures that importing an exported dataset contains the original exported dataset content and row order.
|
||||
|
||||
If these columns are generated by the user, the [CARTO table requirements](https://github.com/CartoDB/cartodb-postgresql/blob/master/doc/CartoDB-user-table.rst) must be followed in order to produce a successful import. Otherwise, importing datasets which do not meet the requirements (such as a dataset with duplicated integers in its `cartodb_id` column) will result in an import failure.
|
||||
|
||||
#### Naming
|
||||
|
||||
Apply the following naming conventions for datasets in CARTO, and avoid using the reserved words as part of your file names.
|
||||
|
||||
* Table names must begin with a letter (a-z). Otherwise, "table_" is prepended to the name
|
||||
* Column names must begin with a letter (a-z) or an underscore (_)
|
||||
* Column and table names can have a maximum of 63 characters. Names are trimmed if they exceed this length
|
||||
|
||||
##### Reserved Words
|
||||
|
||||
There are certain words reserved in the system that cannot be used to name columns or datasets, mainly the PostgreSQL reserved words. Any names that conflict with a reserved word are prefixed with an underscore (_) automatically.
|
||||
|
||||
### Import Guessing
|
||||
|
||||
CARTO includes guessing functionality during the import process. This is useful for when files or data are missing some upload information. The following guessing options are available:
|
||||
|
||||
* **Fields guessing**
|
||||
|
||||
For files whose format does not include type information (usually CSV files), field guessing options can be enabled. There are two particular guessing options for these type of files:
|
||||
|
||||
* **Type guessing**: determines the type of imported columns from the text contents, available in the CSV file. If enabled, it generates numeric and boolean columns when appropriate, otherwise, it uses regular string columns
|
||||
|
||||
* **Quoted fields guessing**: when disabled, avoids double quoted fields for type guessing. Otherwise, double quoted fields are used when enabled
|
||||
|
||||
* **Content Guessing**
|
||||
|
||||
Files that contain country, city, IP address information can be automatically geocoded by the system, if the content guessing option is enabled. This automatic geocoding only occurs if there is not a big proportion of repeated, or null values, in a column. Content guessing does not require the target columns to be named in a special way (such as "country" or "city"), CARTO inspects the different available columns and identifies which of them can be guessed geospatially.
|
||||
|
||||
**Tip:** For information about how to granularly configure the guessing options for your import process, view the upload file parameters on the standard tables section.
|
||||
|
||||
### Supported Geospatial Data Formats
|
||||
|
||||
CARTO supports several geospatial data formats to upload vector data. The important details of each format, as well as some guidelines to upload your files to CARTO, are defined in this section.
|
||||
|
||||
#### Shapefile
|
||||
|
||||
The Shapefile format is a multi-file format — it consists of a set of files with the same name and stored in the same directory, which are differentiated by their extension.
|
||||
|
||||
A Shapefile has to be formed, at least, by a .shp file, a .shx file, a .prj file and a .dbf file. These files contain the geometry data, the indexes, the projection information and the attributes, respectively. Other auxiliary files are not mandatory and contain extra information for the Shapefile. Shapefiles must be imported as a single compressed file, in the .zip or .gz format.
|
||||
|
||||
**Note:** The Shapefile format has certain limitations that can affect the way that your datasets are exported/imported into CARTO:
|
||||
|
||||
* The column name cannot exceed 10 characters. Exporting a dataset with longer names in this format will trim the names
|
||||
* Date columns only support the date, not the time. Exporting and importing a date column as a Shapefile will remove all time information and maintain just the date. If you need to work with date and time data, it is recommended to export/import the information as a string and convert it to a date
|
||||
* Although the projection of the file should be correctly determined and adjusted from the .prj file, it is recommended to upload Shapefiles in the EPSG 4326 projection
|
||||
* For improved compatibility, ensure you save your Shapefile with encoding UTF-8, prior importing
|
||||
|
||||
#### Keyhole Markup Language (KML)
|
||||
|
||||
The KML format is a XML based format which adds to it a geographical meaning by being able to define features such as points, polygons or lines in the EPSG 4326 projection.
|
||||
|
||||
KML uses common XML types such as string, boolean, double, or int, so your column types will be respected when your dataset is imported or exported from CARTO.
|
||||
|
||||
Each feature is defined as a Placemark element, which usually contains a name, a description, and the geometry itself. If more data columns are required, these fields need to be defined and included inside a ExtendedData element of the KML document.
|
||||
|
||||
In terms of geometric elements, the Point, Polygon, Line, MultiGeometry and Geometry elements are supported. Different geometry types in the same layer are not supported.
|
||||
|
||||
#### KMZ
|
||||
|
||||
A Keyhole Markup language Zipped (KMZ) file corresponds to a compressed file, including a KML file and zero, or more, supporting files (images, icons, overlays or other elements referenced in the KML file). See the [Keyhole Markup Language (KML) section for more information](#keyhole-markup-language-kml).
|
||||
|
||||
#### GeoJSON
|
||||
|
||||
The GeoJSON format is an extension of the JavaScript Object Notation (JSON) that encodes geographical features and their metadata. This format supports data types such as string, double or boolean. Dates exported as GeoJSON are stored as strings and will be recognized as such, on data imports.
|
||||
|
||||
With respect to geometries, Points, (Multi)Polygons and (Multi)Lines are supported. GeometryCollection geometric objects are not supported and will raise an import error. The supported geometries can be imported inside FeatureCollection and Feature objects.
|
||||
|
||||
Importing different geometry types in a FeatureCollection element is not supported.
|
||||
|
||||
#### CSV
|
||||
|
||||
Comma-Separated Values (or TSV, Tab-Separated Values) files can be imported to CARTO. For a successful import, follow these formatting guidelines:
|
||||
|
||||
* The first line of the CSV file must contain the name of the columns
|
||||
* The rest of the lines of the CSV file must follow the schema defined by the header column, in terms of number of columns
|
||||
* To ensure correct parsing, it is recommended that string values are double-quoted
|
||||
* If the data itself contains quotes, the values must be double-quoted and the internal quotes must be escaped
|
||||
* CSV lines must be terminated with CR/LF, or LF line terminators. CR line terminators are not supported
|
||||
|
||||
|
||||
###### Example: Quoted strings in a CSV
|
||||
|
||||
`````
|
||||
name, description, score
|
||||
"John Doe", "Awesome, the best player ever", 100
|
||||
`````
|
||||
|
||||
###### Example: Escaped quotes in a CSV
|
||||
|
||||
````
|
||||
name, geojson
|
||||
"Null Island", "{""type"": ""Point"", ""coordinates"": [0,0]}"
|
||||
````
|
||||
|
||||
##### CSV Format Guessing
|
||||
|
||||
As the CSV format does not specify the type of the columns in the data, CARTO applies a guessing functionality that converts your data to columns, using a supported format. This enables you to generate numeric columns, or geocode your dataset directly on import.
|
||||
|
||||
There are two particular guessing options for CSV files: types guessing and quoted fields guessing. View the [Import Guessing](#import-guessing) section for details.
|
||||
|
||||
#### Spreadsheets (Excel or OpenDocument)
|
||||
|
||||
Excel files, or other spreadsheets (such as OpenDocument spreadsheets or Google Drive spreadsheets) are supported by CARTO.
|
||||
|
||||
The format of the uploaded Spreadsheet must apply the following format:
|
||||
|
||||
* The first row must contain the names for each column
|
||||
* Merged cells are not supported
|
||||
* Graphs, charts, or other kind of elements are not supported
|
||||
|
||||
For multi-sheet spreadsheets, only the first sheet will be imported. For the case of Google Drive the maximum size of the spreadhseet is limited to 10MB.
|
||||
|
||||
#### GPX
|
||||
|
||||
The GPX (GPS Exchange Format) files are XML documents that contain waypoints, tracks and/or routes. When importing a GPX file, CARTO will generate different datasets for points, tracks and waypoints. The resulting names of these datasets will be a combination of the GPX name and their type: `_track_points`, `_tracks`, and `_waypoints`, respectively.
|
||||
|
||||
#### OSM
|
||||
|
||||
CARTO supports importing Open Street Map dumps (.osm files). These files are XML documents that have a `osm` parent element that can contain blocks of nodes, ways, or relations representing points, lines or polygons. CARTO will automatically separate OSM dumps into different tables, depending on the geometry. Therefore, importing a single OSM file can lead to more than one resulting dataset.
|
||||
|
||||
#### MapInfo
|
||||
|
||||
The MapInfo file format is geospatial vector data developed by MapInfo, which supports grids based multiple files. MapInfo files (.DAT, .ID, .MAP, .TAB) must be imported as a single compressed file, in the .zip or .gz format.
|
||||
|
||||
##### CARTO
|
||||
|
||||
CARTO files are CARTO generated map visualization files. This .carto file includes the dataset and visualization definition, which contains any SQL queries, CartoCSS, basemaps, attributions, metadata, and styling that was applied to a map. This is useful for downloading complete CARTO visualizations that you can share or import.
|
||||
|
||||
#### GeoPackage
|
||||
|
||||
GeoPackage (GPKG) files are an [open standard format](https://www.geopackage.org/) for spatial data. The format supports multiple layers, and all the geometry types used by CARTO: Points, (Multi)Polygons and and (Multi)Lines. GeoPackage files can be imported as an uncompressed .GPKG file or as a compressed .ZIP file. Each layer (up to 50) in the GeoPackage file will be imported as a separate CARTO table.
|
||||
|
||||
### FileGeodatabase
|
||||
|
||||
File Geodatabase (GDB) is a proprietary [Esri format](http://desktop.arcgis.com/en/arcmap/10.3/manage-data/administer-file-gdbs/file-geodatabases.htm) for spatial data. The GDB format is a directory with a `.gdb` extension containing the data files, so for download and upload a zip file containing the directory is used, either with a `.zip` or a `.gdb.zip` extension. Each layer (up to 50) in the GDB file will be imported as a separate CARTO table.
|
||||
|
||||
**Note:** The "[personal geodatabase](http://desktop.arcgis.com/en/arcmap/latest/manage-data/administer-file-gdbs/personal-geodatabases.htm)" (having a `.mdb` extension) format used by ArcGIS 8 and ArcGIS 9 is not supported by CARTO.
|
||||
|
||||
### Multilayer Uploads
|
||||
|
||||
Several of the formats supported by CARTO can store different layers, or geometric types, by definition. Importing a file that contains more than one layer result in different imported datasets.
|
||||
|
||||
If the option `create_vis` is enabled in the import process, the different layers imported will be added to the created map. The number of layers that can be included in a map depends on the maximum value of layers per map in the configuration of the user.
|
||||
|
||||
The maximum number of datasets created from a multilayer file is 10. If the imported file contains more than 10 layers, those layers are omitted.
|
||||
|
||||
**Important note:** The "[personal geodatabase](http://desktop.arcgis.com/en/arcmap/latest/manage-data/administer-file-gdbs/personal-geodatabases.htm)" (having a `.mdb` extension) format used by ArcGIS 8 and ArcGIS 9 is not supported by CARTO.
|
||||
|
||||
#### Shapefile
|
||||
|
||||
The different layers included in a Shapefile are imported as independent datasets.
|
||||
|
||||
#### KML Files
|
||||
|
||||
KML files generate a different dataset, per each Folder, that they contain.
|
||||
|
||||
#### GPX Files
|
||||
|
||||
GPX files that contain more than one type of elements (waypoints, tracks, and/or routes) are imported in a different dataset, per type.
|
||||
|
||||
#### OSM Files
|
||||
|
||||
OSM files generate a different layer, per each type of geometry that their nodes, ways, or relations represent (points, polygons or lines).
|
||||
|
||||
#### GeoPackage
|
||||
|
||||
GPKG files generate a different dataset for each layer in the file, up to 50.
|
||||
|
||||
#### File Geodatabase
|
||||
|
||||
GDB files generate a different dataset for each layer in the file, up to 50.
|
||||
|
||||
### Multiple File Uploads
|
||||
|
||||
You can perform a batch file upload if the files are sent to the server in a compressed format. As with the case of multilayer uploads, if the import process is configured to generate a map after import, the different datasets are added as layers to the new map. The number of layers that can be included in a map depends on the maximum value of layers allotted to the users account.
|
||||
|
||||
The maximum number of files that can be imported in a single file is 10. If the compressed file contains more than 10 files, only the first 10 files are imported and the rest of the files are omitted.
|
||||
@@ -0,0 +1,44 @@
|
||||
## Column names normalization
|
||||
|
||||
When data is uploaded into CARTO using the Import API, the resulting dataset in CARTO might have different column names than the original dataset.
|
||||
|
||||
This is because as part of the import workflow there's a process to normalize the column names to avoid unsupported column names in the datasets created after the import process finishes. Some of the actions taken when normalizing column names are:
|
||||
|
||||
- Remove accents
|
||||
- Convert multiple consecutive underscores and hyphens to a single underscore
|
||||
- Remove unsupported characters ([]{}&%$+, etc.)
|
||||
- Remove white spaces
|
||||
- Avoid duplicated column names
|
||||
- Avoid column names longer than 63 characters
|
||||
- Avoid reserved words
|
||||
- Force lower case names
|
||||
- Force column names to start by a character
|
||||
|
||||
### Some examples of column name normalization
|
||||
|
||||
Find below a table with some examples of column names and how they are normalized by the Import API:
|
||||
|
||||
| *original column name* | *normalized column name* |
|
||||
| Field: 2 | field_
|
||||
| 2 Items | _2_item
|
||||
| Unnamed: 0 | unnamed_0
|
||||
| 201moore | _201moore
|
||||
| 201moore | _201moore_1
|
||||
| Acadia 1.2.3 | acadia_1_2_3
|
||||
| _testingTesting | _testingtesting
|
||||
| 1 | _1
|
||||
| 1.0 | _1_0
|
||||
| SELECT | _select
|
||||
| à | a
|
||||
| longcolumnshouldbesplittedsomehowanditellyouwhereitsgonnabesplittedrightnow | longcolumnshouldbesplittedsomehowanditellyouwhereitsgonnabespli
|
||||
| longcolumnshouldbesplittedsomehowanditellyouwhereitsgonnabesplittedrightnow | longcolumnshouldbesplittedsomehowanditellyouwhereitsgonnabe_1
|
||||
| all | _all
|
||||
|
||||
### Changing column names
|
||||
|
||||
In some cases you may want to preserve some of the column names in your original data. For example, let's say you have a column name `column__1` which indeed is a valid column name for PostgreSQL and the Import API renamed it as `column_1`. In the case you want to preserve `column__1` as the column name, right after the import process finished you can update the column name using the [CARTO SQL API](https://carto.com/developers/sql-api/) with a query like this:
|
||||
|
||||
```sql
|
||||
ALTER TABLE test_1 RENAME COLUMN column_1 to column__1;
|
||||
SELECT CDB_TableMetadataTouch('test_1');
|
||||
```
|
||||
@@ -0,0 +1,971 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: Import API
|
||||
description: >
|
||||
# Introduction
|
||||
|
||||
The CARTO Import API allows you to upload files to a CARTO account,
|
||||
check on their current upload status, as well as delete and list importing
|
||||
processes on a given account. This API consists of several HTTP requests targeted
|
||||
at a set of CARTO endpoints that deal with the conversion and import of the sent files.
|
||||
CARTO tables can be classified as Standard Tables or Sync Tables. Additionally,
|
||||
the ArcGIS Server™ Connector enables you to import ArcGIS™ layers into your datasets.
|
||||
|
||||
# Authorization
|
||||
|
||||
In order to access Maps API you must provide an API key. The CARTO
|
||||
Authorization guide explains how these keys are sent (TLDR: _HTTP basic
|
||||
auth_ or _query string param_ with the API key token). Depending on the
|
||||
permissions granted to the provided API key, the request will be authorized
|
||||
or not.
|
||||
version: 0.0.1
|
||||
contact:
|
||||
name: Have you found an error? Github issues
|
||||
url: 'https://github.com/CartoDB/Windshaft-cartodb/issues'
|
||||
servers:
|
||||
- url: 'https://{user}.{domain}/api'
|
||||
description: Production server (uses live data)
|
||||
variables:
|
||||
domain:
|
||||
default: carto.com
|
||||
description: 'If on premise, change it to your domain'
|
||||
user:
|
||||
default: username
|
||||
description: Your username
|
||||
tags:
|
||||
- name: Standard Tables
|
||||
description: Store data you upload from files creating tables at CARTO
|
||||
externalDocs:
|
||||
url: 'http://doc.carto.com/pet-operations.htm'
|
||||
- name: CARTO Map Visualizations
|
||||
description: Download a map, and the connected dataset, as a .carto file
|
||||
externalDocs:
|
||||
url: 'http://doc.carto.com/pet-operations.htm'
|
||||
- name: Sync Tables
|
||||
description: Store data from a remote file and refresh their contents during periodic intervals
|
||||
externalDocs:
|
||||
url: 'http://doc.carto.com/pet-operations.htm'
|
||||
paths:
|
||||
'/v1/imports':
|
||||
post:
|
||||
summary: Create import
|
||||
description: |
|
||||
Upload File
|
||||
tags:
|
||||
- Standard Tables
|
||||
operationId: createImport
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateImport'
|
||||
examples:
|
||||
url:
|
||||
$ref: '#/components/examples/CreateImportUrl'
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RequestResponse'
|
||||
example:
|
||||
item_queue_id: 9906bce0-f1a3-4b07-be71-818f4bfd7673
|
||||
success: true
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: |
|
||||
curl -v -F file=@/path/to/local/file "https://{account}
|
||||
.carto.com/api/v1/imports/?api_key={account API Key}"
|
||||
get:
|
||||
summary: List current import processes
|
||||
description: Lists the import identifiers of the files that are being imported in the targeted CARTO account
|
||||
tags:
|
||||
- Standard Tables
|
||||
operationId: getImports
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
imports:
|
||||
type: array
|
||||
description: A list of unique alphanumeric identifiers referencing the import processes in the targeted CARTO account
|
||||
items:
|
||||
type: string
|
||||
success:
|
||||
type: boolean
|
||||
description: A boolean value indicating if the request was successful
|
||||
example:
|
||||
imports:
|
||||
- "1234abcd-1234-1a2b-3c4d-4321dcba5678"
|
||||
success: true
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: >
|
||||
curl -v "https://{account}.carto.com/api/v1/imports/?api_key={account API Key}"
|
||||
'/v1/imports/{import_id}':
|
||||
get:
|
||||
parameters:
|
||||
- in: path
|
||||
name: import_id
|
||||
description: A unique alphanumeric element that identifies the import process to be retrieved. It is the `item_queue_id` element returned after running the upload request successfully.
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
summary: Check import status
|
||||
description: |
|
||||
Returns the Import's status and its associated metadata.
|
||||
tags:
|
||||
- Standard Tables
|
||||
operationId: getImportStatus
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ImportStatusResponse'
|
||||
example:
|
||||
id: 029a6053-b2fb-43dd-baa6-805d679c404f
|
||||
user_id: ca8c5ace-d573-450b-8a43-6c7eafadd80e
|
||||
table_id: null
|
||||
data_type: url
|
||||
table_name: null
|
||||
state: failure
|
||||
error_code: 1002
|
||||
queue_id: 029a6053-b2fb-43dd-baa6-805d679c404f
|
||||
tables_created_count: null
|
||||
synchronization_id: null
|
||||
type_guessing: true
|
||||
quoted_fields_guessing: true
|
||||
content_guessing: false
|
||||
create_visualization: false
|
||||
visualization_id: null
|
||||
user_defined_limits: '{twitter_credits_limit:0}'
|
||||
get_error_text:
|
||||
title: Unsupported/Unrecognized file type
|
||||
what_about: 'Should we support this filetype? Let us know in our <a href=''mailto:support@carto.com''>support email</a>!'
|
||||
source: user
|
||||
display_name: shapefile_streets.cpg
|
||||
success: false
|
||||
warnings: null
|
||||
is_raster: false
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: >
|
||||
curl -v "https://{account}.carto.com/api/v1/imports/{import_id}?api_key={account API Key}
|
||||
'/v3/visualization_exports':
|
||||
post:
|
||||
summary: Export as .carto file
|
||||
description: |
|
||||
The Export map option enables you to download a map,
|
||||
and the connected dataset, as a .carto file. This .carto
|
||||
file includes the dataset and visualization definition,
|
||||
which contains any SQL queries, CartoCSS, basemaps,
|
||||
attributions, metadata, and styling that was applied to a
|
||||
map. This is useful for downloading complete CARTO
|
||||
visualizations that you can share or import.
|
||||
|
||||
Note: The Import API export visualization command only works for maps created from `Your maps` dashboard.
|
||||
tags:
|
||||
- CARTO Map Visualizations
|
||||
operationId: exportCarto
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ExportCarto'
|
||||
example:
|
||||
visualization_id: 'ace62506-brc8-6570-2p91-8vf3af3ftc44'
|
||||
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ExportCartoResponse'
|
||||
example:
|
||||
id: 'b94c26f3-fa16-4f13-b672-45ebbd5a9c95'
|
||||
visualization_id: 'ace62506-brc8-6570-2p91-8vf3af3ftc44'
|
||||
user_id: '42b78090-6a11-475a-8060-0a90322752af2b'
|
||||
state: 'pending'
|
||||
url: null
|
||||
created_at: '2016-05-05T09:36:09+00:00'
|
||||
updated_at: '2016-05-05T09:36:09+00:00'
|
||||
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: |
|
||||
curl -v -H 'Content-Type: application/json' https://{username}.carto.com/api/v3/visualization_exports\?api_key\={api_key} -X POST --data '{"visualization_id":"9a0f4384-afe3-412a-8b09-136b7d9a4013"}'
|
||||
'/v3/visualization_exports/{visualization_export_id}':
|
||||
get:
|
||||
parameters:
|
||||
- in: path
|
||||
name: visualization_export_id
|
||||
description: A unique alphanumeric element that identifies the export process to be retrieved. It is the `id` element returned after running the export request successfully.
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
summary: Check .carto export status
|
||||
description: |
|
||||
After making the POST request to create the export, it is expected that the request will take some time. You must poll the server by making a GET request, until state becomes complete. Once completed, the response status changes to `complete` and displays the upload url location of the .carto visualization file
|
||||
tags:
|
||||
- CARTO Map Visualizations
|
||||
operationId: getExportStatus
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ExportCartoResponse'
|
||||
example:
|
||||
id: 'b94c26f3-fa16-4f13-b672-45ebbd5a9c95'
|
||||
visualization_id: 'ace62506-brc8-6570-2p91-8vf3af3ftc44'
|
||||
user_id: '42b78090-6a11-475a-8060-0a90322752af2b'
|
||||
state: 'complete'
|
||||
url: '/uploads/6a2b6fbd86e2c750160a/ace62506-brc8-6570-2p91-8vf3af3ftc44.carto'
|
||||
created_at: '2016-05-05T09:36:09+00:00'
|
||||
updated_at: '2016-05-05T09:36:13+00:00'
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: >
|
||||
curl -v "https://{account}.carto.com/api/v1/imports/{import_id}?api_key={account API Key}
|
||||
'/v1/synchronizations':
|
||||
get:
|
||||
summary: List current sync tables
|
||||
description: List current sync tables
|
||||
tags:
|
||||
- Sync Tables
|
||||
operationId: getSyncTables
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ListSyncTablesResponse'
|
||||
example:
|
||||
synchronizations:
|
||||
- id: 246dae5e-5302-1ae5-af51-0e85ad047bba
|
||||
name: barrios_5
|
||||
interval: 2592000
|
||||
url: https://common-data.carto.com/api/v2/sql?q=select+*+from+%22barrios%22&format=shp&filename=barrios
|
||||
state: success
|
||||
created_at: '2015-09-04T12:40:37+00:00'
|
||||
updated_at: '2016-02-01T12:45:07+00:00'
|
||||
run_at: '2016-03-02T12:45:07+00:00'
|
||||
retried_times: 0
|
||||
log_id: 2d9b4a52-1daa-429b-b425-6ad561609cb1
|
||||
error_code: null
|
||||
error_message: null
|
||||
ran_at: '2016-02-01T12:45:07+00:00'
|
||||
modified_at: '2015-04-22T12:17:50+00:00'
|
||||
etag: null
|
||||
checksum: null
|
||||
user_id: cf8a5cce-d573-4a0b-8c43-6caeaf1dd80e
|
||||
service_name: null
|
||||
service_item_id: https://common-data.carto.com/api/v2/sql?q=select+*+from+%22barrios%22&format=shp&filename=barrios
|
||||
type_guessing: true
|
||||
quoted_fields_guessing: true
|
||||
content_guessing: true
|
||||
visualization_id: 2954fa60-5a02-11e5-888a-0e5e07bb5d8a
|
||||
from_external_source: false
|
||||
total_entries: 1
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: >
|
||||
curl -v "https://{username}.carto.com/api/v1/synchronizations/?api_key={account API Key}"
|
||||
post:
|
||||
summary: Sync a file from a URL
|
||||
description: |
|
||||
Desc
|
||||
tags:
|
||||
- Sync Tables
|
||||
operationId: syncTable
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateSyncTablesPayload'
|
||||
example:
|
||||
url: 'https://public.url.to.file/sample_file'
|
||||
interval: 3600
|
||||
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateSyncTablesResponse'
|
||||
example:
|
||||
data_import:
|
||||
endpoint: "/api/v1/imports"
|
||||
item_queue_id: 1234abcd-1234-1a2b-3c4d-4321dcba5678
|
||||
id: abcd1234-a5b6-c7d8-1a2b-efgh5678abcd
|
||||
name: null
|
||||
interval: 3600
|
||||
url: https://public.url.to.file/sample_file
|
||||
state: created
|
||||
user_id: aaaabbbb-1234-5678-dcba-abcd1234efgh
|
||||
created_at: '2014-08-05T13:39:15+00:00'
|
||||
updated_at: '2014-08-05T13:39:15+00:00'
|
||||
run_at: '2014-08-05T14:39:15+00:00'
|
||||
ran_at: '2014-08-05T13:39:15+00:00'
|
||||
modified_at: null
|
||||
etag: null
|
||||
checksum: ''
|
||||
log_id: 06fafab8-3502-11e4-9514-0e230854a1cb
|
||||
error_code: null
|
||||
error_message: null
|
||||
retried_times: 0
|
||||
service_name: null
|
||||
service_item_id: null
|
||||
type_guessing: true
|
||||
quoted_fields_guessing: true
|
||||
content_guessing: false
|
||||
visualization_id: null
|
||||
from_external_source: false
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: |
|
||||
curl -v -H "Content-Type: application/json" -d '{"url":"https://public.url.to.file/sample_file", "interval":"3600"}' "https://{username}.carto.com/api/v1/synchronizations/?api_key={account API Key}"
|
||||
'/v1/synchronizations/{import_id}':
|
||||
delete:
|
||||
summary: Remove sync feature from table
|
||||
description: A sync table can be converted to a standard dataset (a dataset that never gets synced)
|
||||
tags:
|
||||
- Sync Tables
|
||||
operationId: removeSyncTables
|
||||
parameters:
|
||||
- in: path
|
||||
name: import_id
|
||||
description: The unique alphanumeric identifier of the target sync dataset
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
responses:
|
||||
'204':
|
||||
description: No content
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: >
|
||||
curl -v -X "DELETE" https://{username}.carto.com/api/v1/synchronizations/{import_id}?api_key={account API Key}"
|
||||
'/v1/synchronizations/{import_id}/sync_now':
|
||||
get:
|
||||
summary: Check whether a sync table is syncing or not
|
||||
description: A large synced table may take some time to get fully synced. In the meantime, it could be useful to check whether it finished refreshing its contents
|
||||
tags:
|
||||
- Sync Tables
|
||||
operationId: checkSyncTables
|
||||
parameters:
|
||||
- in: path
|
||||
name: import_id
|
||||
description: The unique alphanumeric identifier of the target sync dataset
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- created
|
||||
- queued
|
||||
- syncing
|
||||
- success
|
||||
- failure
|
||||
title: State
|
||||
description: A string value indicating the status of the synchronization
|
||||
example:
|
||||
state: syncing
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: >
|
||||
curl -v -X "GET" "https://{username}.carto.com/api/v1/synchronizations/{import_id}/sync_now?api_key={account API Key}"
|
||||
put:
|
||||
summary: Force a synchronization action on a sync table
|
||||
description: |
|
||||
Sync tables have their contents synchronized with the source file in periodic time intervals as specified by the user during the creation process. However, a dataset can be synchronized at an arbitrary moment in time if desired. Note: Forcing a synchronization can only be performed when the last synchronization attempt occurred at least 900 seconds (15 minutes) before.
|
||||
tags:
|
||||
- Sync Tables
|
||||
operationId: forceSyncTable
|
||||
parameters:
|
||||
- in: path
|
||||
name: import_id
|
||||
description: The unique alphanumeric identifier of the target sync dataset
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
responses:
|
||||
'200':
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
enqueued:
|
||||
type: boolean
|
||||
title: Enqueued
|
||||
description: A boolean value indicating whether the request has been successfully appended to the processing queue
|
||||
synchronization_id :
|
||||
type: string
|
||||
title: Synchronization ID
|
||||
description: A unique alphanumeric identifier referring to the queue element just added
|
||||
example:
|
||||
enqueued: false
|
||||
synchronization_id: "1234abcd-aaaa-2222-4444-dcba4321a1b2"
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
security:
|
||||
- ApiKeyHTTPBasicAuth: []
|
||||
- ApiKeyQueryParam: []
|
||||
x-code-samples:
|
||||
- lang: Curl
|
||||
source: |
|
||||
curl -v -X "PUT" "https://{username}.carto.com/api/v1/synchronizations/<import_id>/sync_now?api_key={account API Key}" -H "Content-Length:0"
|
||||
components:
|
||||
schemas:
|
||||
CreateImport:
|
||||
type: object
|
||||
properties:
|
||||
file:
|
||||
$ref: '#/components/schemas/File'
|
||||
url:
|
||||
$ref: '#/components/schemas/Url'
|
||||
type_guessing:
|
||||
type: boolean
|
||||
default: true
|
||||
title: Type guessing
|
||||
description: If set to `false` disables field type guessing (for Excel and CSVs)
|
||||
quoted_fields_guessing:
|
||||
type: boolean
|
||||
default: false
|
||||
title: Quoted fields guessing
|
||||
description: If set to `false` disables type guessing of CSV fields that come inside double quotes
|
||||
content_guessing:
|
||||
type: boolean
|
||||
default: false
|
||||
title: Content guessing
|
||||
description: Set to `true` to enable content guessing and automatic geocoding based on results. Currently, this only implements geocoding of countries, cities and IP addresses
|
||||
create_vis:
|
||||
type: boolean
|
||||
default: false
|
||||
title: Create Vis
|
||||
description: Set to `true` to flag the import so that when it finishes, it creates a Map automatically after importing the Dataset
|
||||
collision_strategy:
|
||||
type: string
|
||||
enum:
|
||||
- skip
|
||||
- overwrite
|
||||
title: Collision strategy
|
||||
description: >
|
||||
Determines the behavior when importing a dataset
|
||||
that has the same name as an existing table. By default,
|
||||
it is imported and renamed with a sequential number
|
||||
(*mytable*, *mytable_1*…).
|
||||
|
||||
- `skip`: the table with the
|
||||
matching name will not be imported.
|
||||
|
||||
- `overwrite`: it will replace
|
||||
the table with the matching name, but only if the new
|
||||
dataset table includes the same columns and data types as
|
||||
the original table. The new table can also include
|
||||
additional columns, but not fewer than the original table.
|
||||
privacy:
|
||||
type: string
|
||||
enum:
|
||||
- public
|
||||
- private
|
||||
- link
|
||||
title: Collision strategy
|
||||
description: >
|
||||
Used to set the privacy settings of the table or
|
||||
tables resulting from the import.
|
||||
If `create_vis` is set to true, the resulting
|
||||
visualization privacy settings will also be
|
||||
determined by this parameter.
|
||||
|
||||
`privacy` can be set to:
|
||||
|
||||
- `public`: The resulting table or visualization can be viewed by anyone
|
||||
|
||||
- `private`: The resulting table or visualization can only be viewed by the uploader
|
||||
|
||||
- `link`: The resulting table or visualization can only be viewed through a private link shared by the uploader
|
||||
table_name:
|
||||
type: string
|
||||
title: Table name
|
||||
description: Used to duplicate one of your existing tables. **Do not mix with File/URL imports**
|
||||
sql:
|
||||
type: string
|
||||
title: SQL
|
||||
description: Used to create a new table from a SQL query applied to one of your tables. **Do not mix with File/URL imports**
|
||||
File:
|
||||
type: string
|
||||
title: file
|
||||
description: When importing local files, you need to perform a POST with a file
|
||||
Url:
|
||||
type: string
|
||||
title: url
|
||||
description: When importing remote files, the full URL to the publicly accessible file
|
||||
RequestResponse:
|
||||
type: object
|
||||
properties:
|
||||
item_queue_id:
|
||||
type: string
|
||||
description: A unique alphanumeric identifier referencing the import process in the targeted account
|
||||
success:
|
||||
type: boolean
|
||||
description: A boolean value indicating whether the import process was started or not.
|
||||
ImportStatusResponse:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
title: ID
|
||||
description: A unique identifier for the import process. It is the same as the `import_id` provided in the request
|
||||
user_id:
|
||||
type: string
|
||||
title: User ID
|
||||
description: A unique alphanumeric element that identifies the CARTO account user in the internal database
|
||||
table_id:
|
||||
type: string
|
||||
title: Table ID
|
||||
description: A unique alphanumeric element that identifies the created table in the internal CARTO database
|
||||
data_type:
|
||||
type: string
|
||||
enum:
|
||||
- file
|
||||
- url
|
||||
- external_table
|
||||
- query
|
||||
- table
|
||||
- datasource
|
||||
title: Data type
|
||||
description: This element identifies the service type used to import the file
|
||||
table_name:
|
||||
type: string
|
||||
title: Table name
|
||||
description: The final name of the created table in the targeted CARTO account. It usually has the same name as the uploaded file, unless there already exists a table with the same name (in this case, an integer number is appended to the table name)
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- enqueued
|
||||
- pending
|
||||
- uploading
|
||||
- unpacking
|
||||
- importing
|
||||
- guessing
|
||||
- complete
|
||||
- failure
|
||||
title: State
|
||||
description: A string value indicating the current state of the importing process
|
||||
error_code:
|
||||
type: number
|
||||
title: Error code
|
||||
description: A number corresponding to the error code in case of failure during the import process, that is, when the `success` item has a `false` value
|
||||
queue_id:
|
||||
type: string
|
||||
title: Queue ID
|
||||
description: A unique identifier for the import process in the importing queue. It is the same as the `import_id` provided in the request
|
||||
tables_created_count:
|
||||
type: number
|
||||
title: Tables created counter
|
||||
description: The number of tables that the import process generated. For multi-file uploads, this value can be greater than one
|
||||
nullable: true
|
||||
synchronization_id:
|
||||
type: string
|
||||
title: Synchronization ID
|
||||
description: This element has a `null` value when the import is not configured as a Sync Table
|
||||
nullable: true
|
||||
type_guessing:
|
||||
type: boolean
|
||||
title: Type guessing
|
||||
description: A boolean indicating whether field type guessing (for Excel and CSVs) is enabled or not
|
||||
quoted_fields_guessing:
|
||||
type: boolean
|
||||
title: Quoted fields guessing
|
||||
description: A boolean indicating whether type guessing of CSV fields inside double quotes is enabled for the data import
|
||||
content_guessing:
|
||||
type: boolean
|
||||
title: Content guessing
|
||||
description: A boolean indicating whether content guessing and automatic geocoding is enabled for the data import
|
||||
create_visualization:
|
||||
type: boolean
|
||||
title: Create visualization
|
||||
description: A boolean indicating whether the import process will create a map automatically or not. Its value corresponds to the import option `create_vis` chosen by the user
|
||||
visualization_id:
|
||||
type: string
|
||||
title: Visualization ID
|
||||
description: A unique identifier for the map created in the import process. Only applies if `created_visualization` is set to `true`
|
||||
nullable: true
|
||||
get_error_text:
|
||||
type: string
|
||||
title: Get error text
|
||||
description: This element contains an error description to be outputted in case of a failure during the import process. It contains the error title and description, its source (`user` or `cartodb`), and troubleshooting details
|
||||
display_name:
|
||||
type: string
|
||||
title: Display name
|
||||
description: Similar to `table_name`. For `url` uploads, it shows the name of the file. Otherwise, it shows the `import_id`
|
||||
success:
|
||||
type: boolean
|
||||
title: Success
|
||||
description: A boolean value indicating whether the import process succeeded
|
||||
warnings:
|
||||
type: string
|
||||
title: Warnings
|
||||
description: A text field containing warning messages related to the import process, if applicable of the file. Otherwise, it shows the `import_id`
|
||||
nullable: true
|
||||
is_raster:
|
||||
type: boolean
|
||||
title: Is raster
|
||||
description: A boolean value indicating whether the imported table contains raster data or not
|
||||
ExportCarto:
|
||||
type: object
|
||||
properties:
|
||||
visualization_id:
|
||||
type: string
|
||||
title: Visualization ID
|
||||
description: A unique identifier for the map created in the export process. Only applies if `created_visualization` is set to `true` when the map was created.
|
||||
ExportCartoResponse:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
title: ID
|
||||
description: A unique identifier for the export process. It is the same as the _export id_ provided in the request
|
||||
visualization_id:
|
||||
type: string
|
||||
title: Visualization ID
|
||||
description: A unique identifier for the map created in the export process. Only applies if `created_visualization` is set to `true` when the map was created
|
||||
user_id:
|
||||
type: string
|
||||
title: User ID
|
||||
description: A unique alphanumeric element that identifies the CARTO account user in the internal database
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- enqueued
|
||||
- pending
|
||||
- uploading
|
||||
- unpacking
|
||||
- importing
|
||||
- guessing
|
||||
- complete
|
||||
- failure
|
||||
title: State
|
||||
description: A string value indicating the current state of the export process
|
||||
url:
|
||||
type: string
|
||||
title: URL
|
||||
description: The **public** URL address where the file to be exported is located
|
||||
nullable: true
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
title: Created at
|
||||
description: The date time at which the visualization was created in the CARTO database
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
title: Updated at
|
||||
description: The date time at which the visualization had its contents modified
|
||||
SyncTablesResponseItem:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
title: ID
|
||||
description: A unique alphanumeric identifier of the synced table
|
||||
name:
|
||||
type: string
|
||||
title: Name
|
||||
description: The actual name of the created sync table
|
||||
interval:
|
||||
type: integer
|
||||
title: Interval
|
||||
description: An integer value representing the number of seconds between synchronizations of the table contents
|
||||
url:
|
||||
type: string
|
||||
title: URL
|
||||
description: The **public** URL address where the file to be synchronized is located
|
||||
nullable: true
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- created
|
||||
- queued
|
||||
- syncing
|
||||
- success
|
||||
- failure
|
||||
title: State
|
||||
description: A string value indicating the current state of the synchronized dataset
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
title: Created at
|
||||
description: The date time at which the table was created in the CARTO database
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
title: Updated at
|
||||
description: The date time at which the table had its contents modified
|
||||
run_at:
|
||||
type: string
|
||||
format: date-time
|
||||
title: Run at
|
||||
description: The date time at which the table **will** get its contents synched with the source file
|
||||
retried_times:
|
||||
type: integer
|
||||
title: Retried times
|
||||
description: An integer value indicating the number of attempts that were performed to sync the table
|
||||
log_id:
|
||||
type: string
|
||||
title: Log ID
|
||||
description: A unique alphanumeric identifier to locate the log traces of the given table
|
||||
error_code:
|
||||
type: integer
|
||||
title: Error code
|
||||
description: An integer value representing a unique error identifier
|
||||
nullable: true
|
||||
error_message:
|
||||
type: string
|
||||
title: Error message
|
||||
description: A string value indicating the message related to the _error_code_ element
|
||||
nullable: true
|
||||
ran_at:
|
||||
type: string
|
||||
format: date-time
|
||||
title: Ran at
|
||||
description: The date time at which the table **had** its contents synched with the source file
|
||||
modified_at:
|
||||
type: string
|
||||
format: date-time
|
||||
title: Modified at
|
||||
description: The date time at which the table was manually modified, if applicable
|
||||
etag:
|
||||
type: string
|
||||
title: ETAG
|
||||
description: HTTP entity tag of the source file
|
||||
nullable: true
|
||||
checksum:
|
||||
type: string
|
||||
title: Checksum
|
||||
description: See **etag**
|
||||
nullable: true
|
||||
user_id:
|
||||
type: string
|
||||
title: User ID
|
||||
description: A unique alphanumeric element that identifies the CARTO account user in the internal database
|
||||
service_name:
|
||||
type: string
|
||||
enum:
|
||||
- gdrive
|
||||
- dropbox
|
||||
title: State
|
||||
description: |
|
||||
A string with the name of the datasource used to import the file
|
||||
It can have any of the following values:
|
||||
- **gdrive** - Google Drive
|
||||
- **dropbox** - Dropbox
|
||||
- `null` - URL imports
|
||||
nullable: true
|
||||
service_item_id:
|
||||
type: string
|
||||
title: Service item ID
|
||||
description: A unique identifier used by CARTO to reference the sync table and its related datasource service
|
||||
type_guessing:
|
||||
type: boolean
|
||||
title: Type guessing
|
||||
description: If set to `false` disables field type guessing (for Excel and CSVs)
|
||||
quoted_fields_guessing:
|
||||
type: boolean
|
||||
title: Quoted fields guessing
|
||||
description: If set to `false` disables type guessing of CSV fields that come inside double quotes
|
||||
content_guessing:
|
||||
type: boolean
|
||||
title: Content guessing
|
||||
description: Set to `true` to enable content guessing and automatic geocoding based on results. Currently, this only implements geocoding of countries, cities and IP addresses
|
||||
visualization_id:
|
||||
type: string
|
||||
title: Visualization ID
|
||||
description: A unique identifier for the map created in the import process. Only applies if created_visualization is set to `true`
|
||||
from_external_source:
|
||||
type: boolean
|
||||
title: From external source
|
||||
description: A boolean indicating whether the Sync Table is connected to an external source, generally the CARTO Data library
|
||||
ListSyncTablesResponse:
|
||||
type: object
|
||||
properties:
|
||||
syncronizations:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/SyncTablesResponseItem'
|
||||
total_entries:
|
||||
type: integer
|
||||
title: Total entries
|
||||
description: Number of items contained in the response array
|
||||
CreateSyncTablesPayload:
|
||||
type: object
|
||||
properties:
|
||||
url:
|
||||
type: string
|
||||
title: URL
|
||||
description: The **public** URL address where the file to be imported is located
|
||||
interval:
|
||||
type: integer
|
||||
title: Interval
|
||||
minimum: 900
|
||||
description: 'The number of seconds for the synchronization period. Note: Sync interval must be at least 900 (15 minutes)'
|
||||
type_guessing:
|
||||
type: boolean
|
||||
title: Type guessing
|
||||
default: true
|
||||
description: If set to `false` disables field type guessing (for Excel and CSVs)
|
||||
quoted_fields_guessing:
|
||||
type: boolean
|
||||
title: Quoted fields guessing
|
||||
default: true
|
||||
description: If set to `false` disables type guessing of CSV fields that come inside double quotes
|
||||
content_guessing:
|
||||
type: boolean
|
||||
title: Content guessing
|
||||
default: false
|
||||
description: Set to `true` to enable content guessing and automatic geocoding based on results. Currently, this only implements geocoding of countries, cities and IP addresses
|
||||
CreateSyncTablesResponse:
|
||||
allOf:
|
||||
- type: object
|
||||
properties:
|
||||
data_import:
|
||||
type: object
|
||||
properties:
|
||||
endpoint:
|
||||
type: string
|
||||
title: Endpoint
|
||||
description: This item refers to the internal CARTO controller code responsible for performing the import
|
||||
item_queue_id:
|
||||
type: string
|
||||
title: Item queue ID
|
||||
description: A unique alphanumeric identifier that refers to the import process. It can be used to retrieve data related to the created table
|
||||
- $ref: '#/components/schemas/SyncTablesResponseItem'
|
||||
|
||||
securitySchemes:
|
||||
ApiKeyHTTPBasicAuth:
|
||||
type: http
|
||||
scheme: basic
|
||||
ApiKeyQueryParam:
|
||||
type: apiKey
|
||||
in: header
|
||||
name: api_key
|
||||
examples:
|
||||
CreateImportUrl:
|
||||
value:
|
||||
url: https://remotehost.url/path/to/remotefile
|
||||
summary: Import from URL
|
||||
RequestResponseSuccess:
|
||||
value:
|
||||
item_queue_id: 9906bce0-f1a3-4b07-be71-818f4bfd7673
|
||||
success: true
|
||||
summary: A success response
|
||||
responses:
|
||||
NotFound:
|
||||
description: The specified resource was not found
|
||||
Unauthorized:
|
||||
description: Unauthorized. No authentication provided.
|
||||
Forbidden:
|
||||
description: Forbidden. The API key does not authorize this request.
|
||||
BadInput:
|
||||
description: Request's parameters error
|
||||
@@ -0,0 +1,36 @@
|
||||
## Support Options
|
||||
|
||||
Feeling stuck? There are many ways to find help.
|
||||
|
||||
* Ask a question on [GIS StackExchange](https://gis.stackexchange.com/questions/tagged/carto) using the `CARTO` tag.
|
||||
* [Report an issue](https://github.com/CartoDB/cartodb/issues) in Github.
|
||||
* Engine Plan customers have additional access to enterprise-level support through CARTO's support representatives.
|
||||
|
||||
If you just want to describe an issue or share an idea, just <a class="typeform-share" href="https://cartohq.typeform.com/to/mH6RRl" data-mode="popup" target="_blank"> send your feedback</a>
|
||||
|
||||
### Issues on Github
|
||||
|
||||
If you think you may have found a bug, or if you have a feature request that you would like to share with the Import API team, please [open an issue](https://github.com/CartoDB/cartodb/issues/new).
|
||||
|
||||
Before opening an issue, review the [contributing guidelines](https://github.com/CartoDB/cartodb/blob/master/CONTRIBUTING.md).
|
||||
|
||||
|
||||
### Community support on GIS Stack Exchange
|
||||
|
||||
GIS Stack Exchange is the most popular community in the geospatial industry. This is a collaboratively-edited question and answer site for geospatial programmers and technicians. It is a fantastic resource for asking technical questions about developing and maintaining your application.
|
||||
|
||||
|
||||
When posting a new question, please consider the following:
|
||||
|
||||
* Read the GIS Stack Exchange [help](https://gis.stackexchange.com/help) and [how to ask](https://gis.stackexchange.com/help/how-to-ask) pages for guidelines and tips about posting questions.
|
||||
* Be very clear about your question in the subject. A clear explanation helps those trying to answer your question, as well as those who may be looking for information in the future.
|
||||
* Be informative in your post. Details, code snippets, logs, screenshots, etc. help others to understand your problem.
|
||||
* Use code that demonstrates the problem. It is very hard to debug errors without sample code to reproduce the problem.
|
||||
|
||||
### Engine Plan Customers
|
||||
|
||||
Engine Plan customers have additional support options beyond general community support. As per your account Terms of Service, you have access to enterprise-level support through CARTO's support representatives available at [enterprise-support@carto.com](mailto:enterprise-support@carto.com)
|
||||
|
||||
In order to speed up the resolution of your issue, provide as much information as possible (even if it is a link from community support). This allows our engineers to investigate your problem as soon as possible.
|
||||
|
||||
If you are not yet CARTO customer, browse our [plans & pricing](https://carto.com/pricing/) and find the right plan for you.
|
||||
@@ -0,0 +1,36 @@
|
||||
## Contribute
|
||||
|
||||
CARTO platform is an open-source ecosystem. You can read about the [fundamentals]({{site.fundamental_docs}}/components/) of CARTO architecture and its components.
|
||||
We are more than happy to receive your contributions to the code and the documentation as well.
|
||||
|
||||
## Filling a ticket
|
||||
|
||||
If you want to open a new issue in our repository, please follow these instructions:
|
||||
|
||||
1. Descriptive title.
|
||||
2. Write a good description, it always helps.
|
||||
3. Specify the steps to reproduce the problem.
|
||||
4. Try to add an example showing the problem.
|
||||
|
||||
## Contributing code
|
||||
|
||||
Best part of open source, collaborate in Import API code!. We like hearing from you, so if you have any bug fixed, or a new feature ready to be merged, those are the steps you should follow:
|
||||
|
||||
1. Fork the repository.
|
||||
2. Create a new branch in your forked repository.
|
||||
3. Commit your changes. Add new tests if it is necessary.
|
||||
4. Open a pull request.
|
||||
5. Any of the maintainers will take a look.
|
||||
6. If everything works, it will merged and released \o/.
|
||||
|
||||
If you want more detailed information, this [GitHub guide](https://guides.github.com/activities/contributing-to-open-source/) is a must.
|
||||
|
||||
## Completing documentation
|
||||
|
||||
Import API documentation is located in ```docs/```. That folder is the content that appears in the [Developer Center](http://carto.com/developers/import-api/). Just follow the instructions described in [contributing code](#contributing-code) and after accepting your pull request, we will make it appear online :).
|
||||
|
||||
**Tip:** A convenient, easy way of proposing changes in documentation is by using the GitHub editor directly on the web. You can easily create a branch with your changes and make a PR from there.
|
||||
|
||||
## Submitting contributions
|
||||
|
||||
You will need to sign a Contributor License Agreement (CLA) before making a submission. [Learn more here](https://carto.com/contributions).
|
||||
@@ -0,0 +1,258 @@
|
||||
|
||||
## Import Errors
|
||||
|
||||
You may receive an error during the import process when connecting a dataset. This section contains any known error codes, and provides descriptions to help you troubleshoot why your import may have failed. Please [contact us](mailto:support@carto.com) if you need assistance.
|
||||
|
||||
The following table contains a list of known errors codes and possible solutions.
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Code</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1000</td>
|
||||
<td>File I/O error - Something seems to be wrong with the file you uploaded. Check that it is loading fine locally and try uploading it again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1001</td>
|
||||
<td>Download error - The remote URL returned an error. Please verify your file is available at that URL.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1002</td>
|
||||
<td>Unsupported file type - Check our <a href="{{site.importapi_docs}}/guides/importing-geospatial-data/#supported-geospatial-data-formats">list of supported files</a>. See if you can convert your file to one of these file types. If importing from a URL, make sure the remote server is returning the appropriate HTTP Content Type headers for the file type.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1003</td>
|
||||
<td>Decompression error - Try decompressing and regenerating your compressed file on your computer. If that fails, then locate the original file and make a new compressed version.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1004</td>
|
||||
<td>XLS/XLSX Error - The XLS/XLSX archive could not be opened or contains data that cannot be imported. Try exporting it into CSV and uploading the CSV instead.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1005</td>
|
||||
<td>Empty file - The file appears to have no processable information. Double check that the file is indeed correct and that it contains supported data.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1006</td>
|
||||
<td>Invalid SHP file - Your file appears broken. Double check that all the necessary parts of the file are included in your ZIP archive (including .SHP, .PRJ, etc.). Also, try opening the file locally using QGIS or another tool.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1007</td>
|
||||
<td>Too many nodes - You requested too many nodes. Either request a smaller area, or use planet.osm.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1008</td>
|
||||
<td>GDrive access forbidden - Google denied access to GDrive. If you use Google Apps contact your administrator to allow third party Drive applications and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1009</td>
|
||||
<td>Twitter Server Error - There was an error connecting to Twitter service to retrieve your tweets. The server might be temporally unavaliable, please try again later.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1010</td>
|
||||
<td>Not a file - Your import request does not contain a file. Make sure that the request is correctly formatted and/or a file is being posted.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1011</td>
|
||||
<td>Error retrieving data from datasource - There was an error retrieving data from the datasource. Check that the file/data is still present.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1012</td>
|
||||
<td>Error connecting to datasource - There was an error trying to connect to the datasource. If this problem stays, please contact <a href='mailto:support@carto.com?subject=Error connecting to datasource'>support@carto.com</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1013</td>
|
||||
<td>Invalid ArcGIS version - The specified ArcGIS server runs an unsupported version. Supported versions are 10.1 onwards.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1014</td>
|
||||
<td>Invalid name - File name is not valid. Maybe too many tables with similar names. Please change file name and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1015</td>
|
||||
<td>No results - Query was correct but returned no results, please change the parameters and run it again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1016</td>
|
||||
<td>Dropbox permission revoked - CARTO has no permission to access your files at Dropbox. Please import file again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1017</td>
|
||||
<td>GDrive file was deleted - GDrive file was removed and can't be synced, please import file again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1018</td>
|
||||
<td>File is password protected - File is password protected and can't be imported. Please remove password protection or create a new compressed file without password and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1019</td>
|
||||
<td>Too Many Layers - The file has too many layers. It can have 50 as maximum.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1020</td>
|
||||
<td>Download timeout - Data download timed out. Check the source is not running slow and/or try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1021</td>
|
||||
<td>Box permission revoked - CARTO has no permission to access your files at Box. Please import file again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1100</td>
|
||||
<td>Download file not found - Provided URL doesn't return a file (error 404). Please check that URL is still valid and that you can download the file and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1101</td>
|
||||
<td>Forbidden file URL - Provided URL returns authentication error. Maybe it's private, or requires user and password. Please provide a valid, public URL and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1102</td>
|
||||
<td>Unknown server URL - Provided URL can't be resolved to a known server. Maybe that URL is wrong or behind a private network. Please provide a valid, public URL and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2001</td>
|
||||
<td>Unable to load data - We couldn't load data from your file into the database. Please <a href='mailto:support@carto.com?subject=Import load error'>contact us</a> and we will help you to load your data.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2002</td>
|
||||
<td>Encoding detection error - We couldn't detect the encoding of your file. Please, try saving your file with encoding UTF-8 or <a href='mailto:support@carto?subject=Encoding error in import'>contact us</a> and we will help you to load your data.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2003</td>
|
||||
<td>Malformed CSV - The CSV or converted XLS/XLSX to CSV file contains malformed or invalid characters. Some reasons for this error can be for example multiline header fields or multiline cells at Excel files or unquoted CSV.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2004</td>
|
||||
<td>Too many columns - Data has too many columns. You can only import up to 250 columns.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2005</td>
|
||||
<td>Duplicated column - File has the same header for two or more columns. Please make column names unique and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2006</td>
|
||||
<td>Encoding error - Problem reading the file. Encoding seems wrong, probably because there's a wrong character. In order to sort it out, open your file with a text editor, save it with encoding UTF-8 and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2007</td>
|
||||
<td>Encoding error - The file you tried to import failed due to encoding issues. To fix this, force the encoding of your file using a text editor or a tool like QGis. You just need to export your files in UTF-8 format.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2008</td>
|
||||
<td>Malformed XLS - The Excel file has an unsupported format or is corrupt. To fix this, open it and save as CSV or XLSX.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2009</td>
|
||||
<td>KML without style Id - The KML file you tried to import failed because a style element doesn't have an ID attribute. To fix this error, please open the file and add an ID to all the style tags.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2010</td>
|
||||
<td>Incompatible CARTO table - There was an error when converting your table into a CARTO table. Please <a href='mailto:support@carto.com?subject=CartoDBfy error'>contact us</a> and we will help you load your data.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2011</td>
|
||||
<td>Invalid `cartodb_id` column - The import failed because your table contains an invalid `cartodb_id` column. If you want to use it as a primary key, its values must be integers, non-null, and unique. Otherwise, try renaming your current `cartodb_id` column.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2012</td>
|
||||
<td>Incompatible schemas - The import failed because you are trying to overwrite a table but the data you are providing is not compatible with the data that table already has. You may me changing some types or removing a column. Please check and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2013</td>
|
||||
<td>Cannot overwrite table - The synchronization failed because the destination table could not be overwritten. Please make sure that there are no database objects (e.g: views) that depend on it.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2014</td>
|
||||
<td>Invalid geometries - Your file appears to contain invalid geometries. Try opening the file with another GIS tool and checking the geometry validity.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3007</td>
|
||||
<td>JSON may not be valid GeoJSON - We can only import GeoJSON formated JSON files. See if the source of this data supports GeoJSON or another file format for download.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3008</td>
|
||||
<td>Unknown SRID - The SRID of the provided file it's not in the spatial_ref_sys table. You can get rid of this error inserting the SRID specific data in the spatial_ref_sys table.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3009</td>
|
||||
<td>SHP Normalization error - We were unable to detect the encoding or projection of your Shapefile. Try converting the file to UTF-8 and a 4326 SRID.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3101</td>
|
||||
<td>Missing projection (.prj) file - CARTO needs a PRJ file for all Shapefile archives uploaded. Contact your data provider to see about aquiring one if it was missing. Otherwise see spatialreference.org to locate the right one if you know it. Remember, the file name for your .prj must be the same as your .shp.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3201</td>
|
||||
<td>Geometry Collection not supported - We are working to support more formats every day, but currently we cannot take mixed geometry types. Take a look at your data source and see if other formats are available, otherwise, look into tools like OGR to split this file into valid ESRI Shapefiles prior to importing.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3202</td>
|
||||
<td>Empty KML - This KML doesn't include actual data, but a link to another KML with the data. Please extract the URL from this KML and try to import it.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8001</td>
|
||||
<td>Over account storage limit, please upgrade - To upgrade your account, go to your Dashboard and click Settings. Click 'Upgrade your server'. Follow the directions for choosing a larger size and setting up your payment information.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8002</td>
|
||||
<td>You have reached the limit of datasets for your plan. Upgrade your account to get unlimited datasets - To upgrade your account, go to your Dashboard and click Settings. Click 'Upgrade your server'. Follow the directions for choosing a larger size and setting up your payment information.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8003</td>
|
||||
<td>Error creating table from SQL query - We couldn't create a table from your query. Please check that it doesn't return duplicate column names.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8004</td>
|
||||
<td>Merge with unmatching column types - The columns you have chosen don't have the same column type in both tables. Please change the types so the columns will have the same type and try again.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8005</td>
|
||||
<td>Max layers per map reached - You can't add more layers to your map. Please upgrade your account.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8006</td>
|
||||
<td>Not enough Twitter credits - Unfortunately, you don't have enough Twitter credits to proceed. Please contact <a href='mailto:sales@carto.com?subject=Exceeded%20Twitter%20quota'>Sales</a> if you have questions about how to obtain more credits.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8007</td>
|
||||
<td>Over account public maps limit, please upgrade - To upgrade your account, go to your Dashboard and click Settings. Click 'Upgrade your server'. Follow the directions for choosing a larger size and setting up your payment information.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6666</td>
|
||||
<td>Dataset too big - The dataset you tried to import is too big and cannot be processed. If the dataset allows it, you can try splitting it into smaller files and then append them once imported, or contact our support team at <a href='mailto:support@carto.com?subject=Dataset%20too%20big%20import%20error'>support@carto.com</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6667</td>
|
||||
<td>Import timed out - There is been a problem importing your file due to the time is been taking to process it. Please try again and contact us if the problem persist.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6668</td>
|
||||
<td>Too many table rows - You cannot import this dataset. The number of rows exceeds the maximum dataset quota permitted for your account. Please contact <a href='mailto:sales@carto.com?subject=Dataset%20too%20many%20table%20rows%20import%20error'>Sales</a> if you have questions about importing this dataset.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6669</td>
|
||||
<td>Too many concurrent imports - You cannot import more data until one of your active imports finishes. If you need further import slots contact our support team at <a href='mailto:support@carto.com?subject=Dataset%20too%20many%20concurrent%20imports%20error'>support@carto.com</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6670</td>
|
||||
<td>Too many map templates - You reached the limit of Named Map templates. If you are programatically generating these templates, check how to delete them in the <a href="{{site.mapsapi_docs}}/guides/quickstart/#named-maps">Maps API documentation</a>. Otherwise, contact our support team at <a href='mailto:support@carto.com?subject=Dataset%20too%20many%20concurrent%20imports%20error'>support@carto.com</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6671</td>
|
||||
<td>Stuck import job - The import job was stuck and we marked it as failed. Please try again and contact our support team at <a href='mailto:support@carto.com?subject=Dataset%20import%20stuck%20error'>support@carto.com</a> if the problem persists.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>99999</td>
|
||||
<td>Unknown - Sorry, something went wrong and we're not sure what. Try
|
||||
uploading your file again, or <a href='mailto:support@carto.com?subject=Unknown error'>contact us</a> and we'll try to help you quickly.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### cURL Commands in Windows
|
||||
|
||||
If you are running cURL commands through a PC console, note that Windows only supports double quotes "" for cURL commands.
|
||||
@@ -0,0 +1,18 @@
|
||||
## Limits
|
||||
|
||||
Limits ensure that CARTO platform is not flooded with so many requests it does not have the time and resources to service them all.
|
||||
|
||||
Currently, Import API is affected by a number of limits.
|
||||
|
||||
|
||||
### Limits Chart
|
||||
|
||||
Below, you can find the values of the timeout limit by user account type.
|
||||
|
||||
| |Free| Pro |Enterprise|
|
||||
|--- | --- | ---| ---|
|
||||
|Maximum concurrent imports | 3 imports enqueued per request | 3 imports enqueued per request | 3 imports enqueued per request
|
||||
|Maximum row count | 500K | 500K | 1M
|
||||
|Maximum file size | 150MB | 500MB | 1GB
|
||||
|Maximum feature vertex count | 10K | 10K | 10K
|
||||
|Maximum number of tables | 2000 tables | 2000 tables | 2000 tables
|
||||
Reference in New Issue
Block a user