newdocs: fix titles

This commit is contained in:
Carlos Matallín 2015-10-22 15:02:01 +02:00
parent 8db1ad6f19
commit 5e0c9377f2
4 changed files with 57 additions and 57 deletions

View File

@ -1,17 +1,17 @@
## Anonymous Maps
# Anonymous Maps
Anonymous maps allows you to instantiate a map given SQL and CartoCSS. It also allows you to add interaction capabilities using [UTF Grid.](https://github.com/mapbox/utfgrid-spec)
### Instantiate
## Instantiate
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```html
POST /api/v1/map
```
#### Params
### Params
```javascript
{
@ -30,7 +30,7 @@ POST /api/v1/map
Should be a [Mapconfig](https://github.com/CartoDB/Windshaft/blob/0.44.1/doc/MapConfig-1.3.0.md).
#### Response
### Response
The response includes:
@ -51,7 +51,7 @@ The response includes:
- **cdn_url**
URLs to fetch the data using the best CDN for your zone.
#### Example
### Example
<div class="code-title code-request with-result">REQUEST</div>
```bash
@ -78,9 +78,9 @@ curl 'https://documentation.cartodb.com/api/v1/map' -H 'Content-Type: applicatio
}
```
##### Retrieve resources from the layergroup
#### Retrieve resources from the layergroup
###### Mapnik tiles can be accessed using:
##### Mapnik tiles can be accessed using:
These tiles will get just the mapnik layers. To get individual layers see next section.
@ -88,7 +88,7 @@ These tiles will get just the mapnik layers. To get individual layers see next s
https://documentation.cartodb.com/api/v1/map/c01a54877c62831bb51720263f91fb33:0/{z}/{x}/{y}.png
```
###### Individual layers
##### Individual layers
The MapConfig specification holds the layers definition in a 0-based index. Layers can be requested individually in different formats depending on the layer type.
@ -106,7 +106,7 @@ If the MapConfig had a Torque layer at index 1 it could be possible to request i
https://documentation.cartodb.com/api/v1/map/c01a54877c62831bb51720263f91fb33:0/1/{z}/{x}/{y}.torque.json
```
###### Attributes defined in `attributes` section:
##### Attributes defined in `attributes` section:
```bash
https://documentation.cartodb.com/api/v1/map/c01a54877c62831bb51720263f91fb33:0/:layer/attributes/:feature_id
@ -118,7 +118,7 @@ Which returns JSON with the attributes defined, like:
{ "c": 1, "d": 2 }
```
###### Blending and layer selection
##### Blending and layer selection
```bash
https://documentation.cartodb.com/api/v1/map/c01a54877c62831bb51720263f91fb33:0/:layer_filter/{z}/{x}/{y}.png
@ -154,18 +154,18 @@ Some notes about filtering:
may change in the future **it is recommended** to always select the layers in ascending order so you will get a
consistent behavior in the future.
### Create JSONP
## Create JSONP
The JSONP endpoint is provided in order to allow web browsers access which don't support CORS.
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```bash
GET /api/v1/map?callback=method
```
#### Params
### Params
- **config**
Encoded JSON with the params for creating named maps (the variables defined in the template).
@ -176,7 +176,7 @@ GET /api/v1/map?callback=method
- **callback**
JSON callback name.
#### Example
### Example
<div class="code-title code-request with-result">REQUEST</div>
```bash
@ -195,6 +195,6 @@ callback({
})
```
### Remove
## Remove
Anonymous maps cannot be removed by an API call. They will expire after about five minutes but sometimes longer. If an anonymous map expires and tiles are requested from it, an error will be raised. This could happen if a user leaves a map open and after time, returns to the map and attempts to interact with it in a way that requires new tiles (e.g. zoom). The client will need to go through the steps of creating the map again to fix the problem.

View File

@ -1,14 +1,14 @@
## General Concepts
# General Concepts
The following concepts are the same for every endpoint in the API except when it's noted explicitly.
### Auth
## Auth
By default, users do not have access to private tables in CartoDB. In order to instantiate a map from private table data an API Key is required. Additionally, to include some endpoints, an API Key must be included (e.g. creating a named map).
To execute an authorized request, `api_key=YOURAPIKEY` should be added to the request URL. The param can be also passed as POST param. Using HTTPS is mandatory when you are performing requests that include your `api_key`.
### Errors
## Errors
Errors are reported using standard HTTP codes and extended information encoded in JSON with this format:
@ -22,6 +22,6 @@ Errors are reported using standard HTTP codes and extended information encoded i
If you use JSONP, the 200 HTTP code is always returned so the JavaScript client can receive errors from the JSON object.
### CORS support
## CORS support
All the endpoints, which might be accessed using a web browser, add CORS headers and allow OPTIONS method.

View File

@ -1,4 +1,4 @@
## Named Maps
# Named Maps
Named maps are essentially the same as anonymous maps except the MapConfig is stored on the server and the map is given a unique name. Two other big differences are: you can create named maps from private data and that users without an API Key can see them even though they are from that private data.
@ -12,16 +12,16 @@ The main two differences compared to anonymous maps are:
Template maps are persistent with no preset expiration. They can only be created or deleted by a CartoDB user with a valid API_KEY (see auth section).
### Create
## Create
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```html
POST /api/v1/map/named
```
#### Params
### Params
- **api_key** is required
@ -76,7 +76,7 @@ POST /api/v1/map/named
}
```
##### Arguments
#### Arguments
- **name**: There can be at most _one_ template with the same name for any user. Valid names start with a letter or a number, and only contain letters, numbers, dashes (-) or underscores (_).
- **auth**:
@ -95,13 +95,13 @@ POST /api/v1/map/named
- **east**: UpperCorner longitude for the bounding box, in decimal degrees (aka most eastern)
- **north**: UpperCorner latitude for the bounding box, in decimal degrees (aka most northern)
#### Template Format
### Template Format
A templated `layergroup` allows the use of placeholders in the "cartocss" and "sql" elements of the "option" object in any "layer" of a `layergroup` configuration
Valid placeholder names start with a letter and can only contain letters, numbers, or underscores. They have to be written between the `<%=` and `%>` strings in order to be replaced.
##### Example
#### Example
```javascript
<%= my_color %>
@ -109,7 +109,7 @@ Valid placeholder names start with a letter and can only contain letters, number
The set of supported placeholders for a template will need to be explicitly defined with a specific type and default value for each.
#### Placeholder Types
### Placeholder Types
The placeholder type will determine the kind of escaping for the associated value. Supported types are:
@ -137,18 +137,18 @@ curl -X POST \
}
```
### Instantiate
## Instantiate
Instantiating a map allows you to get the information needed to fetch tiles. That temporal map is an anonymous map.
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```html
POST /api/v1/map/named/:template_name
```
#### Param
### Param
- **auth_token** optional, but required when `"method"` is set to `"token"`
@ -164,7 +164,7 @@ The fields you pass as `params.json` depend on the variables allowed by the name
- **auth_token** *optional* if the named map needs auth
#### Example
### Example
You can initialize a template map by passing all of the required parameters in a POST to `/api/v1/map/named/:template_name`.
@ -195,18 +195,18 @@ curl -X POST \
You can then use the `layergroupid` for fetching tiles and grids as you would normally (see anonymous map section). However you'll need to show the `auth_token`, if required by the template.
### Using JSONP
## Using JSONP
There is also a special endpoint to be able to initialize a map using JSONP (for old browsers).
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```bash
GET /api/v1/map/named/:template_name/jsonp
```
#### Params
### Params
- **auth_token** optional, but required when `"method"` is set to `"token"`
- **config** Encoded JSON with the params for creating named maps (the variables defined in the template)
@ -246,28 +246,28 @@ callback({
})
```
### Update
## Update
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```bash
PUT /api/v1/map/named/:template_name
```
#### Params
### Params
- **api_key** is required
#### Response
### Response
Same as updating a map.
#### Other Info
### Other Info
Updating a named map removes all the named map instances so they need to be initialized again.
#### Example
### Example
<div class="code-title code-request with-result">REQUEST</div>
```bash
@ -294,22 +294,22 @@ If a template with the same name does NOT exist, a 400 HTTP response is generate
}
```
### Delete
## Delete
Delete the specified template map from the server and it disables any previously initialized versions of the map.
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```bash
DELETE /api/v1/map/named/:template_name
```
#### Params
### Params
- **api_key** is required
#### Example
### Example
<div class="code-title code-request">REQUEST</div>
```bash
@ -325,22 +325,22 @@ curl -X DELETE 'https://documentation.cartodb.com/api/v1/map/named/:template_nam
On success, a 204 (No Content) response will be issued. Otherwise a 4xx response with an error will be returned.
### Listing Available Templates
## Listing Available Templates
This allows you to get a list of all available templates.
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```bash
GET /api/v1/map/named/
```
#### Params
### Params
- **api_key** is required
#### Example
### Example
<div class="code-title code-request with-result">REQUEST</div>
```bash
@ -361,22 +361,22 @@ curl -X GET 'https://documentation.cartodb.com/api/v1/map/named?api_key=APIKEY'
}
```
### Getting a Specific Template
## Getting a Specific Template
This gets the definition of a template.
#### Definition
### Definition
<div class="code-title notitle code-request"></div>
```bash
GET /api/v1/map/named/:template_name
```
#### Params
### Params
- **api_key** is required
#### Example
### Example
<div class="code-title code-request with-result">REQUEST</div>
```bash
@ -397,7 +397,7 @@ curl -X GET 'https://documentation.cartodb.com/api/v1/map/named/:template_name?a
}
```
### Use with CartoDB.js
## Use with CartoDB.js
Named maps can be used with CartoDB.js by specifying a named map in a layer source as follows. Named maps are treated almost the same as other layer source types in most other ways.
```js

View File

@ -1,4 +1,4 @@
## Quickstart
# Quickstart
You can create two types of maps with the Maps API:
@ -8,7 +8,7 @@ You can create two types of maps with the Maps API:
- **Named maps**
There are also maps that have access to your private data. These maps require an owner to setup and modify any SQL and CartoCSS parameters and are not modifiable without new setup calls.
### Anonymous maps
## Anonymous maps
Here is an example of how to create an anonymous map with JavaScript:
@ -39,7 +39,7 @@ $.ajax({
})
```
### Named maps
## Named maps
Let's create a named map using some private tables in a CartoDB account.
The following map config sets up a map of European countries that have a white fill color: