-
Notifications
You must be signed in to change notification settings - Fork 1
/
CARTO_Training_Collection.postman_collection.json
529 lines (529 loc) · 19 KB
/
CARTO_Training_Collection.postman_collection.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
{
"variables": [],
"info": {
"name": "Training Collection",
"_postman_id": "8831a16d-5f58-7576-bfca-06c1802dc8eb",
"description": "updated version at: \n\nhttps://raw.githubusercontent.com/ernesmb/CARTO-Engine-collection/master/CARTO_Training_Collection.postman_collection.json",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Enterprise API",
"description": "Organization management API",
"item": [
{
"name": "Create a new ORG user",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var jsonData = JSON.parse(responseBody);\n\npostman.setEnvironmentVariable(\"ORG_USER\", jsonData.username)"
}
}
],
"request": {
"url": "https://{{ORG}}.carto.com/u/{{ORG_OWNER}}/api/v1/organization/{{ORG}}/users?api_key={{OWNER_KEY}}",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"username\":\"org-user\", \n\t\"email\":\"[email protected]\", \n\t\"password\":\"viewersecret!\",\n\t\"soft_geocoding_limit\":false,\n\t\"quota_in_bytes\":157286400,\n\t\"viewer\":false\n}"
},
"description": "Use the org. owner account to create a new user with the specified data"
},
"response": []
},
{
"name": "Update ORG user",
"request": {
"url": "https://{{ORG}}.carto.com/u/{{ORG_OWNER}}/api/v1/organization/{{ORG}}/users/{{ORG_USER}}?api_key={{OWNER_KEY}}",
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"username\":\"org-user-new-name\", \n\t\"email\":\"[email protected]\", \n\t\"password\":\"secret!new\",\n\t\"soft_geocoding_limit\":false,\n\t\"quota_in_bytes\":157286400\n}"
},
"description": "Use the org. owner account to update an org. user account with the specified data"
},
"response": []
},
{
"name": "Show ORG user info",
"request": {
"url": "https://{{ORG}}.carto.com/u/{{ORG_OWNER}}/api/v1/organization/{{ORG}}/users/{{ORG_USER}}?api_key={{OWNER_KEY}}",
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"username\":\"org-user\", \n\t\"email\":\"[email protected]\", \n\t\"password\":\"secret!\",\n\t\"soft_geocoding_limit\":false,\n\t\"quota_in_bytes\":157286400\n}"
},
"description": "Use the org. owner account to get info from an org. user account"
},
"response": []
},
{
"name": "Remove ORG user",
"request": {
"url": "https://{{ORG}}.carto.com/u/{{ORG_OWNER}}/api/v1/organization/{{ORG}}/users/{{ORG_USER}}?api_key={{OWNER_KEY}}",
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"description": "Use the org. owner account to remove an user from an organization"
},
"response": []
}
]
},
{
"name": "Imports",
"description": "",
"item": [
{
"name": "Import a file",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var jsonData = JSON.parse(responseBody);\n\npostman.setEnvironmentVariable(\"IMPORT_ID\", jsonData.item_queue_id);"
}
}
],
"request": {
"url": "https://{{USER}}.carto.com/api/v1/imports?api_key={{KEY}}",
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"description": "Create a new CARTO dataset by uploading a local .csv file"
},
"response": []
},
{
"name": "Import from URL",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var jsonData = JSON.parse(responseBody);\n\npostman.setEnvironmentVariable(\"IMPORT_ID\", jsonData.item_queue_id);"
}
}
],
"request": {
"url": "https://{{USER}}.carto.com/api/v1/imports/?api_key={{KEY}}&url={{URL}}",
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": "We just need to pass the URL as a parameter\n\nhttp://www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip"
},
"response": []
},
{
"name": "Check current imports",
"request": {
"url": "https://{{USER}}.carto.com/api/v1/imports/?api_key={{KEY}}",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": "It will return only currently existing proccesses"
},
"response": []
},
{
"name": "Check specific import",
"request": {
"url": "https://{{USER}}.carto.com/api/v1/imports/{{IMPORT_ID}}?api_key={{KEY}}",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": "Adding the {{import_id}} value, it will return information about that specific proccess"
},
"response": []
},
{
"name": "Check current synchronizations",
"request": {
"url": "https://{{USER}}.carto.com/api/v1/synchronizations/?api_key={{KEY}}",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Import from ArcGIS Server",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var jsonData = JSON.parse(responseBody);\n\npostman.setEnvironmentVariable(\"IMPORT_ID\", jsonData.item_queue_id);"
}
}
],
"request": {
"url": "https://{{USER}}.carto.com/api/v1/imports/?api_key={{KEY}}",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"interval\":\"900\",\n\t\"service_item_id\":\"http://url.to.arcgis.server.layer\",\n\t\"service_name\":\"arcgis\",\n\t\"value\":\"http://url.to.arcgis.server.layer\"\n}"
},
"description": "We need to edit the payload to edit the sync interval and the service URL"
},
"response": []
}
]
},
{
"name": "Maps",
"description": "Maps API requests",
"item": [
{
"name": "Instantiate Anonymous Map",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var jsonData = JSON.parse(responseBody);\n\npostman.setEnvironmentVariable(\"LAYERGROUPID\", jsonData.layergroupid);"
}
}
],
"request": {
"url": "https://{{USER}}.carto.com/api/v1/map/",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"version\": \"1.0.1\",\n \"layers\": [\n {\n \"type\": \"cartodb\",\n \"options\": {\n \"sql\": \"select * from world_borders\",\n \"cartocss\": \"\\/** simple visualization *\\/\\n\\n#world_borders{\\n polygon-fill: #3E7BB6;\\n polygon-opacity: 0.7;\\n line-color: #FFF;\\n line-width: 0.5;\\n line-opacity: 1;\\n}\",\n \"cartocss_version\": \"2.1.1\",\n \"interactivity\": [\n \"cartodb_id\"\n ]\n }\n }\n ]\n}"
},
"description": "No API key required"
},
"response": []
},
{
"name": "Get Static Map with Center+Zoom+Resolution",
"request": {
"url": "http://{{USER}}.carto.com/api/v1/map/static/center/{{LAYERGROUPID}}/{{ZOOM}}/{{CENTER_LAT}}/{{CENTER_LON}}/{{WIDTH}}/{{HEIGHT}}.png",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": ""
},
"response": []
},
{
"name": "Get Static Map with BBOX+Resolution",
"request": {
"url": "http://{{USER}}.carto.com/api/v1/map/static/bbox/{{LAYERGROUPID}}/{{WEST}},{{SOUTH}},{{EAST}},{{NORTH}}/{{WIDTH}}/{{HEIGHT}}.png",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": ""
},
"response": []
}
]
},
{
"name": "Named Maps",
"description": "Most common operations with Named Maps\n",
"item": [
{
"name": "Get Templates",
"request": {
"url": "https://{{USER}}.carto.com/api/v1/map/named?api_key={{KEY}}",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": ""
},
"response": []
},
{
"name": "Create a new Named Map",
"request": {
"url": "https://{{USER}}.carto.com/api/v1/map/named?api_key={{KEY}}",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"auth\": {\n \"method\": \"token\",\n \"valid_tokens\": [\n \t\"cartodb\",\n \t\"carto\"\n \t]\n },\n \"version\": \"0.0.1\",\n \"name\": \"named_map_test\",\n \"placeholders\": {\n \"filter\": {\n \"type\": \"number\",\n \"default\": 2\n },\n \"color\": {\n \"type\": \"css_color\",\n \"default\": \"#FF0000\"\n }\n },\n \"layergroup\": {\n \"version\": \"1.0.1\",\n \"layers\": [\n {\n \"type\": \"cartodb\",\n \"options\": {\n \"sql\": \"select * from world_borders\",\n \"layer_name\": \"world_borders\",\n \"cartocss\": \"#layer { polygon-fill: lighten(red,30); polygon-opacity: 0.1; line-color: #F00; }\",\n \"cartocss_version\": \"2.1.1\",\n \"interactivity\": [\n \"cartodb_id\",\n \"name\"\n ],\n \"table_name\": \"\\\"\\\".\",\n \"attributes\": {\n \"id\": \"cartodb_id\",\n \"columns\": [\n \"name\",\n \"region\",\n \"iso2\",\n \"iso3\",\n \"pop2005\"\n ]\n }\n }\n },\n {\n \"type\": \"cartodb\",\n \"options\": {\n \"sql\": \"select * from ne_10m_populated_places_simple where pop_max > <%= filter %>\",\n \"layer_name\": \"populated_places\",\n \"cartocss\": \"#populated_places{ marker-line-opacity: 0; marker-width: 30; marker-fill: <%= color %>; marker-allow-overlap: true;}\",\n \"cartocss_version\": \"2.1.1\",\n \"interactivity\": [\n \"cartodb_id\",\n \"name\"\n ],\n \"table_name\": \"\\\"\\\".\",\n \"attributes\": {\n \"id\": \"cartodb_id\",\n \"columns\": [\n \"adm0name\",\n \"name\"\n ]\n }\n }\n }\n ]\n },\n \"view\": {\n \"zoom\": 3,\n \"center\": {\n \"lng\": 0,\n \"lat\": 0\n },\n \"bounds\": {\n \"west\": -80,\n \"south\": -40,\n \"east\": 80,\n \"north\": 40\n }\n }\n}"
},
"description": ""
},
"response": []
},
{
"name": "Get a Template",
"request": {
"url": "https://{{USER}}.carto.com/api/v1/map/named/{{TEMPLATE}}?api_key={{KEY}}",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": ""
},
"response": []
},
{
"name": "Instantiate a named map with params (solutions)",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var jsonData = JSON.parse(responseBody);\n\npostman.setEnvironmentVariable(\"LAYERGROUPID\", jsonData.layergroupid);"
}
}
],
"request": {
"url": "https://{{USER}}.carto.com/api/v1/map/named/named_map_test?auth_token=cartodb",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"color\": \"green\",\n \"filter\": 5\n}"
},
"description": ""
},
"response": []
},
{
"name": "Update a template",
"request": {
"url": "https://{{USER}}.carto.com/api/v1/map/named/named_map_test?api_key={{KEY}}",
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"auth\": {\n \"method\": \"token\",\n \"valid_tokens\": [\n \t\"cartodb\",\n \t\"carto\"\n \t]\n },\n \"version\": \"0.0.1\",\n \"name\": \"named_map_test\",\n \"placeholders\": {\n \"filter\": {\n \"type\": \"number\",\n \"default\": 2\n },\n \"color\": {\n \"type\": \"css_color\",\n \"default\": \"#FF0000\"\n }\n },\n \"layergroup\": {\n \"version\": \"1.0.1\",\n \"layers\": [\n {\n \"type\": \"cartodb\",\n \"options\": {\n \"sql\": \"select * from world_borders\",\n \"layer_name\": \"world_borders\",\n \"cartocss\": \"#layer { polygon-fill: lighten(blue,30); polygon-opacity: 0.1; line-color: #F00; }\",\n \"cartocss_version\": \"2.1.1\",\n \"interactivity\": [\n \"cartodb_id\",\n \"name\"\n ],\n \"table_name\": \"\\\"\\\".\",\n \"attributes\": {\n \"id\": \"cartodb_id\",\n \"columns\": [\n \"name\",\n \"region\",\n \"iso2\",\n \"iso3\",\n \"pop2005\"\n ]\n }\n }\n },\n {\n \"type\": \"cartodb\",\n \"options\": {\n \"sql\": \"select * from populated_places where pop_max > <%= filter %>\",\n \"layer_name\": \"populated_places\",\n \"cartocss\": \"#populated_places{ marker-line-opacity: 0; marker-width: 15; marker-fill: <%= color %>; marker-allow-overlap: true;}\",\n \"cartocss_version\": \"2.1.1\",\n \"interactivity\": [\n \"cartodb_id\",\n \"name\"\n ],\n \"table_name\": \"\\\"\\\".\",\n \"attributes\": {\n \"id\": \"cartodb_id\",\n \"columns\": [\n \"adm0name\",\n \"name\"\n ]\n }\n }\n }\n ]\n },\n \"view\": {\n \"zoom\": 3,\n \"center\": {\n \"lng\": 0,\n \"lat\": 0\n },\n \"bounds\": {\n \"west\": -80,\n \"south\": -40,\n \"east\": 80,\n \"north\": 40\n }\n }\n }"
},
"description": ""
},
"response": []
},
{
"name": "Delete a template",
"request": {
"url": "https://{{USER}}.carto.com/api/v1/map/named/{{TEMPLATE}}?api_key={{KEY}}",
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": ""
},
"description": ""
},
"response": []
}
]
},
{
"name": "SQL",
"description": "Collection of request to SQL API",
"item": [
{
"name": "Simple SQL query",
"request": {
"url": "https://{{USER}}.carto.com/api/v2/sql/?q=SELECT+cartodb_id,iso2,name,area,pop2005+FROM+world_borders+LIMIT+10&api_key={{KEY}}",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": "SELECT * FROM world_borders"
},
"response": []
},
{
"name": "Simple SQL query via POST",
"request": {
"url": "http://{{USER}}.carto.com/api/v2/sql?api_key={{KEY}}",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"q\":\"INSERT INTO dummy_dataset (c) VALUES ('testingAPI')\"\n}"
},
"description": "The query content will not be publicly sent in the URL, as it is part of the request payload"
},
"response": []
},
{
"name": "SQL API --> GeoJSON",
"request": {
"url": "https://{{USER}}.carto.com/api/v2/sql/?q=SELECT+*+FROM+world_borders+LIMIT+5&api_key={{KEY}}&format=geojson",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": "Downloads the query result in the specified format"
},
"response": []
},
{
"name": "SQL API --> Shapefile",
"request": {
"url": "https://{{USER}}.carto.com/api/v2/sql/?q=SELECT+*+FROM+world_borders+LIMIT+5&api_key={{KEY}}&format=shp",
"method": "GET",
"header": [],
"body": {
"mode": "formdata",
"formdata": []
},
"description": "Downloads the query result in the specified format"
},
"response": []
},
{
"name": "Create Batch SQL Job",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var jsonData = JSON.parse(responseBody);\n\npostman.setEnvironmentVariable(\"JOB_ID\", jsonData.job_id);"
}
}
],
"request": {
"url": "http://{{USER}}.carto.com/api/v2/sql/job?api_key={{KEY}}",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"query\":\"SELECT * FROM populated_places\"\n}"
},
"description": "This is a SQL query that will run in batches, avoiding timeouts"
},
"response": []
},
{
"name": "Check an specific Batch SQL Job",
"request": {
"url": "http://{{USER}}.carto.com/api/v2/sql/job/{{JOB_ID}}?api_key={{KEY}}",
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"query\":\"SELECT * FROM populated_places\"\n}"
},
"description": "Will respond with an objects with the job we have requested"
},
"response": []
}
]
}
]
}