Merge pull request #1119 from CartoDB/fix-curl-docs-windows
Fix cURL docs for Windows users by using files
This commit is contained in:
commit
71dba04d83
@ -90,10 +90,26 @@ paths:
|
|||||||
x-code-samples:
|
x-code-samples:
|
||||||
- lang: Curl
|
- lang: Curl
|
||||||
source: |
|
source: |
|
||||||
curl -X POST -H "Content-Type: application/json" -d '{ \
|
# body.json
|
||||||
"q": "SELECT count(*) FROM cities", \
|
{
|
||||||
"filename": "number_of_cities.json" \
|
"version": "1.3.0",
|
||||||
}' "https://username.carto.com/api/v2/sql"
|
"layers": [
|
||||||
|
{
|
||||||
|
"type": "mapnik",
|
||||||
|
"options": {
|
||||||
|
"cartocss_version": "2.1.1",
|
||||||
|
"cartocss": "#layer { polygon-fill: #FFF; }",
|
||||||
|
"sql": "select * from european_countries_e",
|
||||||
|
"interactivity": [
|
||||||
|
"cartodb_id",
|
||||||
|
"iso3"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
curl -X POST -H "Content-Type: application/json" -d @body.json "https://username.carto.com/api/v2/sql"
|
||||||
'/map/{layergroupid}/{z}/{x}/{y}.png':
|
'/map/{layergroupid}/{z}/{x}/{y}.png':
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
@ -277,57 +293,60 @@ paths:
|
|||||||
x-code-samples:
|
x-code-samples:
|
||||||
- lang: Curl
|
- lang: Curl
|
||||||
source: |
|
source: |
|
||||||
curl -X POST -H "Content-Type: application/json" -d '{ \
|
# body.json
|
||||||
"version": "0.0.1", \
|
{
|
||||||
"name": "template_name", \
|
"version": "0.0.1",
|
||||||
"auth": { \
|
"name": "template_name",
|
||||||
"method": "token", \
|
"auth": {
|
||||||
"valid_tokens": [ \
|
"method": "token",
|
||||||
"auth_token1", \
|
"valid_tokens": [
|
||||||
"auth_token2" \
|
"auth_token1",
|
||||||
] \
|
"auth_token2"
|
||||||
}, \
|
]
|
||||||
"placeholders": { \
|
},
|
||||||
"color": { \
|
"placeholders": {
|
||||||
"type": "css_color", \
|
"color": {
|
||||||
"default": "red" \
|
"type": "css_color",
|
||||||
}, \
|
"default": "red"
|
||||||
"cartodb_id": { \
|
},
|
||||||
"type": "number", \
|
"cartodb_id": {
|
||||||
"default": 1 \
|
"type": "number",
|
||||||
} \
|
"default": 1
|
||||||
}, \
|
}
|
||||||
"layergroup": { \
|
},
|
||||||
"version": "1.7.0", \
|
"layergroup": {
|
||||||
"layers": [ \
|
"version": "1.7.0",
|
||||||
{ \
|
"layers": [
|
||||||
"type": "cartodb", \
|
{
|
||||||
"options": { \
|
"type": "cartodb",
|
||||||
"cartocss_version": "2.3.0", \
|
"options": {
|
||||||
"cartocss": "#layer { polygon-fill: <%= color %>; }", \
|
"cartocss_version": "2.3.0",
|
||||||
"sql": "select * from european_countries_e WHERE cartodb_id = <%= cartodb_id %>" \
|
"cartocss": "#layer { polygon-fill: <%= color %>; }",
|
||||||
} \
|
"sql": "select * from european_countries_e WHERE cartodb_id = <%= cartodb_id %>"
|
||||||
} \
|
}
|
||||||
] \
|
}
|
||||||
}, \
|
]
|
||||||
"view": { \
|
},
|
||||||
"zoom": 4, \
|
"view": {
|
||||||
"center": { \
|
"zoom": 4,
|
||||||
"lng": 0, \
|
"center": {
|
||||||
"lat": 0 \
|
"lng": 0,
|
||||||
}, \
|
"lat": 0
|
||||||
"bounds": { \
|
},
|
||||||
"west": -45, \
|
"bounds": {
|
||||||
"south": -45, \
|
"west": -45,
|
||||||
"east": 45, \
|
"south": -45,
|
||||||
"north": 45 \
|
"east": 45,
|
||||||
}, \
|
"north": 45
|
||||||
"preview_layers": { \
|
},
|
||||||
"0": true, \
|
"preview_layers": {
|
||||||
"layer1": false \
|
"0": true,
|
||||||
} \
|
"layer1": false
|
||||||
} \
|
}
|
||||||
}' "https://{username}.carto.com/api/v1/map/named?api_key={api_key}"
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curl -X POST -H "Content-Type: application/json" -d @body.json "https://{username}.carto.com/api/v1/map/named?api_key={api_key}"
|
||||||
get:
|
get:
|
||||||
summary: List user's templates
|
summary: List user's templates
|
||||||
description: |
|
description: |
|
||||||
@ -424,59 +443,62 @@ paths:
|
|||||||
x-code-samples:
|
x-code-samples:
|
||||||
- lang: Curl
|
- lang: Curl
|
||||||
source: |
|
source: |
|
||||||
|
# body.json
|
||||||
|
{
|
||||||
|
"version": "0.0.1",
|
||||||
|
"name": "template_name",
|
||||||
|
"auth": {
|
||||||
|
"method": "token",
|
||||||
|
"valid_tokens": [
|
||||||
|
"auth_token1",
|
||||||
|
"auth_token2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"placeholders": {
|
||||||
|
"color": {
|
||||||
|
"type": "css_color",
|
||||||
|
"default": "red"
|
||||||
|
},
|
||||||
|
"cartodb_id": {
|
||||||
|
"type": "number",
|
||||||
|
"default": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"layergroup": {
|
||||||
|
"version": "1.7.0",
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"type": "cartodb",
|
||||||
|
"options": {
|
||||||
|
"cartocss_version": "2.3.0",
|
||||||
|
"cartocss": "#layer { polygon-fill: <%= color %>; }",
|
||||||
|
"sql": "select * from european_countries_e WHERE cartodb_id = <%= cartodb_id %>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"view": {
|
||||||
|
"zoom": 4,
|
||||||
|
"center": {
|
||||||
|
"lng": 0,
|
||||||
|
"lat": 0
|
||||||
|
},
|
||||||
|
"bounds": {
|
||||||
|
"west": -45,
|
||||||
|
"south": -45,
|
||||||
|
"east": 45,
|
||||||
|
"north": 45
|
||||||
|
},
|
||||||
|
"preview_layers": {
|
||||||
|
"0": true,
|
||||||
|
"layer1": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
curl -X PUT \
|
curl -X PUT \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{ \
|
-d @body.json
|
||||||
"version": "0.0.1", \
|
|
||||||
"name": "template_name", \
|
|
||||||
"auth": { \
|
|
||||||
"method": "token", \
|
|
||||||
"valid_tokens": [ \
|
|
||||||
"auth_token1", \
|
|
||||||
"auth_token2" \
|
|
||||||
] \
|
|
||||||
}, \
|
|
||||||
"placeholders": { \
|
|
||||||
"color": { \
|
|
||||||
"type": "css_color", \
|
|
||||||
"default": "red" \
|
|
||||||
}, \
|
|
||||||
"cartodb_id": { \
|
|
||||||
"type": "number", \
|
|
||||||
"default": 1 \
|
|
||||||
} \
|
|
||||||
}, \
|
|
||||||
"layergroup": { \
|
|
||||||
"version": "1.7.0", \
|
|
||||||
"layers": [ \
|
|
||||||
{ \
|
|
||||||
"type": "cartodb", \
|
|
||||||
"options": { \
|
|
||||||
"cartocss_version": "2.3.0", \
|
|
||||||
"cartocss": "#layer { polygon-fill: <%= color %>; }", \
|
|
||||||
"sql": "select * from european_countries_e WHERE cartodb_id = <%= cartodb_id %>" \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
] \
|
|
||||||
}, \
|
|
||||||
"view": { \
|
|
||||||
"zoom": 4, \
|
|
||||||
"center": { \
|
|
||||||
"lng": 0, \
|
|
||||||
"lat": 0 \
|
|
||||||
}, \
|
|
||||||
"bounds": { \
|
|
||||||
"west": -45, \
|
|
||||||
"south": -45, \
|
|
||||||
"east": 45, \
|
|
||||||
"north": 45 \
|
|
||||||
}, \
|
|
||||||
"preview_layers": { \
|
|
||||||
"0": true, \
|
|
||||||
"layer1": false \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
}' \
|
|
||||||
'https://{username}.carto.com/api/v1/map/named/{template_name}?api_key={api_key}'
|
'https://{username}.carto.com/api/v1/map/named/{template_name}?api_key={api_key}'
|
||||||
delete:
|
delete:
|
||||||
summary: Delete template
|
summary: Delete template
|
||||||
@ -548,12 +570,15 @@ paths:
|
|||||||
x-code-samples:
|
x-code-samples:
|
||||||
- lang: Curl
|
- lang: Curl
|
||||||
source: |
|
source: |
|
||||||
|
# body.json
|
||||||
|
{
|
||||||
|
"color": "#ff0000",
|
||||||
|
"cartodb_id": 3
|
||||||
|
}
|
||||||
|
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{ \
|
-d @body.json
|
||||||
"color": "#ff0000", \
|
|
||||||
"cartodb_id": 3 \
|
|
||||||
}' \
|
|
||||||
'https://{username}.carto.com/api/v1/map/named/{template_name}?auth_token={auth_token}'
|
'https://{username}.carto.com/api/v1/map/named/{template_name}?auth_token={auth_token}'
|
||||||
'/map/named/{template_name}/jsonp':
|
'/map/named/{template_name}/jsonp':
|
||||||
get:
|
get:
|
||||||
|
Loading…
Reference in New Issue
Block a user