changed documentation variable to username throughout, and other clean-up

This commit is contained in:
csobier 2016-03-22 11:23:04 -04:00
parent 8547cb836f
commit 43d1e5c613
4 changed files with 23 additions and 30 deletions

View File

@ -46,7 +46,7 @@ cdn_url | URLs to fetch the data using the best CDN for your zone.
#### Call
```bash
curl 'https://{documentation}.cartodb.com/api/v1/map' -H 'Content-Type: application/json' -d @mapconfig.json
curl 'https://{username}.cartodb.com/api/v1/map' -H 'Content-Type: application/json' -d @mapconfig.json
```
#### Response
@ -79,7 +79,7 @@ When you have a layergroup, there are several resources for retrieving layergoup
These tiles will get just the Mapnik layers. To get individual layers, see the following section.
```bash
https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33:0}/{z}/{x}/{y}.png
https://{username}.cartodb.com/api/v1/map/{layergroupid}/{z}/{x}/{y}.png
```
#### Individual layers
@ -89,21 +89,21 @@ The MapConfig specification holds the layers definition in a 0-based index. Laye
Individual layers can be accessed using that 0-based index. For UTF grid tiles:
```bash
https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33:0}/{layer}/{z}/{x}/{y}.grid.json
https://{username}.cartodb.com/api/v1/map/{layergroupid}/{layer}/{z}/{x}/{y}.grid.json
```
In this case, `{layer}` as 0 returns the UTF grid tiles/attributes for layer 0, the only layer in the example MapConfig.
In this case, `layer` as 0 returns the UTF grid tiles/attributes for layer 0, the only layer in the example MapConfig.
If the MapConfig had a Torque layer at index 1 it could be possible to request it with:
```bash
https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33:0}/1/{z}/{x}/{y}.torque.json
https://{username}.cartodb.com/api/v1/map/{layergroupid}/1/{z}/{x}/{y}.torque.json
```
#### Attributes defined in `attributes` section
```bash
https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33:0}/{layer}/attributes/{feature_id}
https://{username}.cartodb.com/api/v1/map/{layergroupid}/{layer}/attributes/{feature_id}
```
Which returns JSON with the attributes defined, like:
@ -115,19 +115,19 @@ Which returns JSON with the attributes defined, like:
#### Blending and layer selection
```bash
https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33:0}/{layer_filter}/{z}/{x}/{y}.png
https://{username}.cartodb.com/api/v1/map/{layergroupid}/{layer_filter}/{z}/{x}/{y}.png
```
Note: currently format is limited to `png`.
`{layer_filter]` can be used to select some layers to be rendered together. `{layer_filter}` supports two formats:
`layer_filter` can be used to select some layers to be rendered together. `layer_filter` supports two formats:
- `all` alias
Using `all` as `{layer_filter}` will blend all layers in the layergroup
Using `all` as `layer_filter` will blend all layers in the layergroup
```bash
https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33:0}/all/{z}/{x}/{y}.png
https://{username}.cartodb.com/api/v1/map/{layergroupid}/all/{z}/{x}/{y}.png
```
- Filter by layer index
@ -135,7 +135,7 @@ https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33
A list of comma separated layer indexes can be used to just render a subset of layers. For example `0,3,4` will filter and blend layers with indexes 0, 3, and 4.
```bash
https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33:0}/0,3,4/{z}/{x}/{y}.png
https://{username}.cartodb.com/api/v1/map/{layergroupid}/0,3,4/{z}/{x}/{y}.png
```
Some notes about filtering:
@ -172,7 +172,7 @@ callback | JSON callback name.
#### Call
```bash
curl "https://{documentation}.cartodb.com/api/v1/map?callback=callback&config={%7B%22version%22%3A%221.0.1%22%2C%22layers%22%3A%5B%7B%22type%22%3A%22cartodb%22%2C%22options%22%3A%7B%22sql%22%3A%22select+%2A+from+european_countries_e%22%2C%22cartocss%22%3A%22%23european_countries_e%7B+polygon-fill%3A+%23FF6600%3B+%7D%22%2C%22cartocss_version%22%3A%222.3.0%22%2C%22interactivity%22%3A%5B%22cartodb_id%22%5D%7D%7D%5D%7D}"
curl "https://{username}.cartodb.com/api/v1/map?callback=callback&config=%7B%22version%22%3A%221.0.1%22%2C%22layers%22%3A%5B%7B%22type%22%3A%22cartodb%22%2C%22options%22%3A%7B%22sql%22%3A%22select+%2A+from+european_countries_e%22%2C%22cartocss%22%3A%22%23european_countries_e%7B+polygon-fill%3A+%23FF6600%3B+%7D%22%2C%22cartocss_version%22%3A%222.3.0%22%2C%22interactivity%22%3A%5B%22cartodb_id%22%5D%7D%7D%5D%7D"
```
#### Response

View File

@ -168,13 +168,6 @@ The response back from the API provides the name of your MapConfig as a template
}
```
#### Placeholder Errors
As developers use many different methods to input placeholder variables, you may find external placeholder examples with other symbols such as, <template_id>, :template_id, $template_id, or @template_id; indicating that a placeholder variable should be added. For best practices and consistency, CartoDB uses curly brackets to represent placeholders in our examples. (Note that JSON **Response** examples show “{variable_name}”: “{value}", these are specific to how JSON files are formatted.
If an error is raised during a request, ensure that your placeholder variables appear without any added symbols.
## Instantiate
Instantiating a Named Map allows you to fetch the map tiles. You can use the Maps API to instantiate, or use the CartoDB.js `createLayer()` function. The result is an Anonymous Map.
@ -216,7 +209,7 @@ Valid auth token will be needed, if required by the template.
curl -X POST \
-H 'Content-Type: application/json' \
-d @params.json \
'https://{documentation}.cartodb.com/api/v1/map/named/{template_name}?auth_token={auth_token}'
'https://{username}.cartodb.com/api/v1/map/named/{template_name}?auth_token={auth_token}'
```
#### Response
@ -268,7 +261,7 @@ Updating a Named Map removes all the Named Map instances, so they need to be ini
curl -X PUT \
-H 'Content-Type: application/json' \
-d @template.json \
'https://{documentation}.cartodb.com/api/v1/map/named/{template_name}?api_key={api_key}'
'https://{username}.cartodb.com/api/v1/map/named/{template_name}?api_key={api_key}'
```
#### Response
@ -310,7 +303,7 @@ api_key | is required
#### Call
```bash
curl -X DELETE 'https://{documentation}.cartodb.com/api/v1/map/named/{template_name}?api_key={api_key}'
curl -X DELETE 'https://{username}.cartodb.com/api/v1/map/named/{template_name}?api_key={api_key}'
```
#### Response
@ -344,7 +337,7 @@ api_key | is required
#### Call
```bash
curl -X GET 'https://{documentation}.cartodb.com/api/v1/map/named?api_key={api_key}'
curl -X GET 'https://{username}.cartodb.com/api/v1/map/named?api_key={api_key}'
```
#### Response
@ -384,7 +377,7 @@ api_key | is required
#### Call
```bash
curl -X GET 'https://{documentation}.cartodb.com/api/v1/map/named/{template_name}?api_key={api_key}'
curl -X GET 'https://{username}.cartodb.com/api/v1/map/named/{template_name}?api_key={api_key}'
```
#### Response
@ -425,7 +418,7 @@ callback | JSON callback name
#### Call
```bash
curl 'https://{documentation}.cartodb.com/api/v1/map/named/{template_name}/jsonp?auth_token={auth_token}&callback=callback&config=template_params_json'
curl 'https://{username}.cartodb.com/api/v1/map/named/{template_name}/jsonp?auth_token={auth_token}&callback=callback&config=template_params_json'
```
#### Response

View File

@ -22,10 +22,10 @@ $.ajax({
type: 'POST',
dataType: 'json',
contentType: 'application/json',
url: 'https://{documentation}.cartodb.com/api/v1/map',
url: 'https://{username}.cartodb.com/api/v1/map',
data: JSON.stringify(mapconfig),
success: function(data) {
var templateUrl = 'https://{documentation}.cartodb.com/api/v1/map/' + data.layergroupid + '/{z}/{x}/{y}.png'
var templateUrl = 'https://{username}.cartodb.com/api/v1/map/' + data.layergroupid + '/{z}/{x}/{y}.png'
console.log(templateUrl);
}
})
@ -96,5 +96,5 @@ Note: all `layers` in `metadata` will always have a `type` string and a `meta` d
You can use the `layergroupid` to instantiate a URL template for accessing tiles on the client. Here we use the `layergroupid` from the example response above in this URL template:
```bash
https://{documentation}.cartodb.com/api/v1/map/{c01a54877c62831bb51720263f91fb33:0}/{z}/{x}/{y}.png
https://{username}.cartodb.com/api/v1/map/{layergroupid}/{z}/{x}/{y}.png
```

View File

@ -57,7 +57,7 @@ format | the bounding box in WGS 84 (EPSG:4326), comma separated values for:
Note: you can see this endpoint as
```bash
GET /api/v1/map/static/bbox/{token}/{west,south,east,north}/{width}/{height}.{format}`
GET /api/v1/map/static/bbox/{token}/{west},{south},{east},{north}/{width}/{height}.{format}`
```
### Named Map
@ -160,7 +160,7 @@ After instantiating a map from a CartoDB account:
#### Call
```bash
GET /api/v1/map/static/center/{4b615ff367e498e770e7d05e99181873:1420231989550.8699/14/40.71502926732618/-73.96039009094238/600/400.png}
GET /api/v1/map/static/center/{layergroupid}/{z}/{x}/{y}/{width}/{height}.png
```
#### Response