forked from Leaf-Agriculture/Leaf-API-Postman-Collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeaf API.postman_collection.json
More file actions
12708 lines (12708 loc) · 347 KB
/
Leaf API.postman_collection.json
File metadata and controls
12708 lines (12708 loc) · 347 KB
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
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"info": {
"_postman_id": "ed89f877-6296-430c-9f9a-565eefc5a8fd",
"name": "Leaf API",
"description": "Leaf API Postman Collection\n\n\n- Import Postman Collection\n- Import Environment Variables\n- Register with Leaf \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nVersion 0.0.1",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "31093199"
},
"item": [
{
"name": "Quickstart",
"item": [
{
"name": "Get your Leaf Token",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.environment.set(\"leaf_token\", jsonData.id_token);",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"{{leaf_email}}\",\n \"password\": \"{{leaf_pass}}\",\n \"rememberMe\": true\n}\n// if rememberMe = \"true\", your Leaf Token lasts 30 days. If \"false\", your Leaf Token lasts 24h."
},
"url": {
"raw": "https://{{leaf_api_url}}/api/authenticate",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"api",
"authenticate"
]
}
},
"response": []
},
{
"name": "Get all fields",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{leaf_token}}"
}
],
"url": {
"raw": "https://{{leaf_api_url}}/services/fields/api/fields",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"services",
"fields",
"api",
"fields"
]
}
},
"response": []
},
{
"name": "Get all operation files",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{leaf_token}}"
}
],
"url": {
"raw": "https://{{leaf_api_url}}/services/operations/api/files",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"services",
"operations",
"api",
"files"
]
}
},
"response": []
},
{
"name": "Get operation file by id",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{leaf_token}}"
}
],
"url": {
"raw": "https://{{leaf_api_url}}/services/operations/api/files/{{file_id}}",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"services",
"operations",
"api",
"files",
"{{file_id}}"
]
}
},
"response": []
},
{
"name": "Get operation file summary",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{leaf_token}}"
}
],
"url": {
"raw": "https://{{leaf_api_url}}/services/operations/api/files/{{file_id}}/summary",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"services",
"operations",
"api",
"files",
"{{file_id}}",
"summary"
]
}
},
"response": []
},
{
"name": "Get operation file images",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{leaf_token}}"
}
],
"url": {
"raw": "https://{{leaf_api_url}}/services/operations/api/files/{{file_id}}/images",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"services",
"operations",
"api",
"files",
"{{file_id}}",
"images"
]
}
},
"response": []
},
{
"name": "Get merged operation file",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{leaf_token}}"
}
],
"url": {
"raw": "https://{{leaf_api_url}}/services/operations/api/files?origin=merged",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"services",
"operations",
"api",
"files"
],
"query": [
{
"key": "origin",
"value": "merged"
}
]
}
},
"response": []
},
{
"name": "Get all sat-monitored fields",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{leaf_token}}"
}
],
"url": {
"raw": "https://{{leaf_api_url}}/services/satellite/api/fields",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"services",
"satellite",
"api",
"fields"
]
}
},
"response": []
},
{
"name": "Get satellite images",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{leaf_token}}"
}
],
"url": {
"raw": "https://{{leaf_api_url}}/services/satellite/api/fields/{{sat_external_id}}/processes",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"services",
"satellite",
"api",
"fields",
"{{sat_external_id}}",
"processes"
]
}
},
"response": []
}
],
"description": "Leaf Auth\nGet Leaf Token\nAfter registering with Leaf, you can get your Leaf token, which must be included in all requests to Leaf’s API as an authorization header.\n\tHow to get your Leaf Token:\nUpdate current value of \"leaf_email\" variable to your Leaf account email\nUpdate current value of \"leaf_pass\" variable to your Leaf account password\nHit \"Send\"\n\nAn \"id_token\" should be returned. It will be automatically transferred to the current value of \"leaf_token\" to be used in all calls to Leaf's API",
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "API Reference",
"item": [
{
"name": "Leaf auth",
"item": [
{
"name": "Get your Leaf Token",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.environment.set(\"leaf_token\", jsonData.id_token);",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"{{leaf_email}}\",\n \"password\": \"{{leaf_pass}}\",\n \"rememberMe\": true\n}\n// if rememberMe = \"true\", your Leaf Token lasts 30 days. If \"false\", your Leaf Token lasts 24h."
},
"url": {
"raw": "https://{{leaf_api_url}}/api/authenticate",
"protocol": "https",
"host": [
"{{leaf_api_url}}"
],
"path": [
"api",
"authenticate"
]
}
},
"response": []
}
],
"description": "Leaf Auth\nGet Leaf Token\nAfter registering with Leaf, you can get your Leaf token, which must be included in all requests to Leaf’s API as an authorization header.\n\tHow to get your Leaf Token:\nUpdate current value of \"leaf_email\" variable to your Leaf account email\nUpdate current value of \"leaf_pass\" variable to your Leaf account password\nHit \"Send\"\n\nAn \"id_token\" should be returned. It will be automatically transferred to the current value of \"leaf_token\" to be used in all calls to Leaf's API",
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "Providers auth",
"item": [
{
"name": "JohnDeere auth",
"item": [
{
"name": "1. Get John Deere auth URL",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"clientKey\": \"{{jd_client_id}}\",\n \"clientSecret\": \"{{jd_client_secret}}\",\n \"clientRedirectUrl\": \"{{jd_redirect_url}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{leaf_auth_jd}}/get_url",
"protocol": "https",
"host": [
"{{leaf_auth_jd}}"
],
"path": [
"get_url"
]
},
"description": "Access token (and refresh token) request as detailed on step 4 of the medium post"
},
"response": []
},
{
"name": "2. Get John Deere Tokens",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.environment.set(\"jd_access_token\", jsonData.access_token);",
"pm.environment.set(\"jd_refresh_token\", jsonData.refresh_token);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "{{leaf_token}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"clientKey\": \"{{jd_client_id}}\",\n \"clientSecret\": \"{{jd_client_secret}}\",\n \"responseUrl\": \"{{jd_response_url}}\",\n \"clientRedirectUrl\": \"{{jd_redirect_url}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{leaf_auth_jd}}/get_token",
"protocol": "https",
"host": [
"{{leaf_auth_jd}}"
],
"path": [
"get_token"
]
},
"description": "Access token (and refresh token) request as detailed on step 4 of the medium post"
},
"response": []
}
],
"description": "John Deere Auth\nTo get a better sense of the authentication process with John Deere and the results, check our Medium Post (https://medium.com/leaf-agriculture/how-to-use-leafs-api-to-retrieve-machinery-data-from-john-deere-fb1ba331d089)\n1. Get John Deere auth URL\nIn Step 1 we will be generating tokens from John Deere. The goal In step 2 is we will get our john deere token_id and token_secret\n\nToken Verifier\nIn step 1 we will get a temporary \"token verifier\" from John Deere that confirms a user’s authentication of your application to access their John Deere data and generate credentials. We get that verifier by going through their authentication flow (oauth2).\nBefore generating the authentication URL, please:\nUpdate current value of \"jd_client_key\" to your app's client key on John Deere\nUpdate current value of \"jd_client_secret\" to your app's client secret on John Deere\nUpdate current value of \"jd_callback_url\" to your app's callback_url on John Deere\n\nThen, to generate the authentication URL your application will send to your user so they can authorize access to their account files you can use the included step 2 in the Postman Collection. Change \"client_key\" and \"client_secret\" variables to yours received from John Deere when you created an app on your developer account with them and redirect_uri to a uri the \"token verifier\" will be sent after the user authorizes your application.\nHit \"Send\".\nRedirect your user to the url included in the response.\nThey will authenticate and be redirected to the redirect_url\nCopy the entire url you were redirected to. It looks like:\nhttps://leafagriculture.com.br/?oauth_token=TOKEN&oauth_verifier=CODE\nPaste it in the environment variable \"jd_response_url\"\n2. Get John Deere Tokens\nAfter updating the “jd_response_url” in Postman you can submit your credentials and receive your tokens:\nHit \"Send\"\n\n\"token_id\" and \"token_secret_key\" will be automatically transferred to \"jd_token_id\" and \"jd_token_secret\" environment variables and will be used in the next step.\n\n3. Add John Deere ID\nNow we can create a Developer-User pair credentials ID that will allow you to access your user’s John Deere data. We first add the John Deere credentials to Leaf API, just:\nHit \"Send\"\nAll the info needed has already been filled automatically in Step 2.\n\nAn \"id\" for the credentials you just created will be returned. This \"id\" will be automatically transferred to the value of \"jd_credentials_id\" to be used in the next step.\n",
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "ClimateFieldView auth",
"item": [
{
"name": "1. Get CFV auth URL",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n\t\"client_id\": \"{{cfv_client_id}}\",\n\t\"redirect_uri\": \"{{cfv_redirect_url}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{leaf_auth_cfv}}/url",
"protocol": "https",
"host": [
"{{leaf_auth_cfv}}"
],
"path": [
"url"
]
}
},
"response": []
},
{
"name": "2. Get CFV Tokens",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.environment.set(\"cfv_access_token\", jsonData.access_token);",
"pm.environment.set(\"cfv_refresh_token\", jsonData.refresh_token);"
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
"// Here we calculate the Authorization Header, it is calculated as:",
"// Basic {base64_encode($clientId:$clientSecret)} ",
"",
"var id = pm.environment.get('cfv_client_id');",
"var sec = pm.environment.get('cfv_client_secret');",
"",
"var id_sec = id + \":\" + sec;",
"var id_sec_64 = btoa(id_sec); // encodes to Base64",
"",
"var cfv_auth_header = \"Basic \";",
"var cfv_auth_header = cfv_auth_header + id_sec_64;",
"",
"pm.environment.set('cfv_auth_header', cfv_auth_header);",
"",
"// to see if it's working, check that ",
"// clientId being Aladdin and clientSecret being OpenSesame, ",
"// will generate the Authorization Header below",
"// Basic QWxhZGRpbjpPcGVuU2VzYW1l"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "{{cfv_auth_header}}",
"description": "Basic base64(clientId:clientSecret)",
"type": "text"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "code",
"value": "{{cfv_code}}",
"description": "get code from redirect url and put here",
"type": "text"
},
{
"key": "redirect_uri",
"value": "{{cfv_redirect_url}}",
"description": "same as when on the url you sent to user ",
"type": "text"
},
{
"key": "grant_type",
"value": "authorization_code",
"type": "text"
}
]
},
"url": {
"raw": "https://api.climate.com/api/oauth/token",
"protocol": "https",
"host": [
"api",
"climate",
"com"
],
"path": [
"api",
"oauth",
"token"
]
},
"description": "Access token (and refresh token) request as detailed on step 4 of the medium post"
},
"response": []
}
],
"description": "Climate Field View Auth\nTo get a better sense of the authentication process with Climate Field View and the results, check our Medium Post (https://medium.com/leaf-agriculture/how-to-use-leafs-api-to-retrieve-machinery-data-from-climate-fieldview-dda921f40291)\n\n1. Get CFV auth URL\nWe will be generating a url to redirect your user to authenticate with Climate.\nUpdate environment variables \"cfv_client_id\" and \"cfv_client_secret\" to your CFV developer account credentials\nUpdate environment variable \"cfv_redirect_url\" to your application's backend\nRedirect your user to the script's output url.\nThey will authenticate and be redirected to the redirect_uri\nA code will be sent to that cfv_redirect_url. We will need this code Step 2.\nCopy the code value \nNote: this code expires after 1 minute.\n\nPaste code value to environment variable \"cfv_code\"\n\n2. Get CFV tokens\nHit \"Send\"\n\nA lot of information will be returned. The important ones are \"access_token\" and \"refresh_token. These will be automatically transferred to \"cfv_access_token\" and \"cfv_refresh_token\" environment variables and will be used in the next step.\n\t\n3. Add CFV credentials\nNow we can create a Developer-User pair credentials ID that will allow you to access your user’s Climate data. We first add the Climate credentials to Leaf API, to do that:\nHit \"Send\"\n\nAn \"id\" for the credentials you just created will be returned. This \"id\" will be automatically transferred to the value of \"cfv_credentials_id\" to be used in the next step.",
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "CNHi auth",
"item": [
{
"name": "1. Get CNHI auth URL",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"client_id\": \"{{cnhi_client_id}}\",\n \"client_secret\": \"{{cnhi_client_secret}}\",\n \"client_redirect_url\": \"{{cnhi_client_redirect_url}}\",\n \"production\": {{cnhi_production_client}}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{leaf_auth_cnhi}}/get_url",
"protocol": "https",
"host": [
"{{leaf_auth_cnhi}}"
],
"path": [
"get_url"
]
}
},
"response": []
},
{
"name": "2. Get CNHI Refresh Token",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.environment.set(\"cnhi_refresh_token\", jsonData.refresh_token);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"client_id\": \"{{cnhi_client_id}}\",\n \"client_secret\": \"{{cnhi_client_secret}}\",\n \"client_redirect_url\": \"{{cnhi_client_redirect_url}}\",\n \"response_url\": \"{{cnhi_response_url}}\",\n \"production\": {{cnhi_production_client}}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{leaf_auth_cnhi}}/get_token",
"protocol": "https",
"host": [
"{{leaf_auth_cnhi}}"
],
"path": [
"get_token"
]
}
},
"response": []
}
]
},
{
"name": "Raven auth",
"item": [
{
"name": "Get Raven auth URL",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"client_id\": \"{{raven_client_id}}\",\n \"client_redirect_url\": \"{{raven_redirect_url}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{leaf_auth_raven}}/get_url",
"protocol": "https",
"host": [
"{{leaf_auth_raven}}"
],
"path": [
"get_url"
]
}
},
"response": []
},
{
"name": "Get Raven Token",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"client_id\": \"{{raven_client_id}}\",\n \"client_secret\": \"{{raven_client_secret}}\",\n \"redirect_url\": \"{{raven_redirect_url}}\",\n \"code\": \"{{raven_code}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{leaf_auth_raven}}/get_token",
"protocol": "https",
"host": [
"{{leaf_auth_raven}}"
],
"path": [
"get_token"
]
}
},
"response": []
}
]
},
{
"name": "Stara auth",
"item": [
{
"name": "Get Stara API key",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.environment.set(\"stara_api_key\", jsonData.key);",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "",
"value": "",
"type": "text",
"disabled": true
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "user",
"value": "{{stara_username}}",
"type": "text"
},
{
"key": "pwd",
"value": "{{stara_password}}",
"type": "text"
}
]
},
"url": {
"raw": "https://v2apitelemetria.telemetriastara.com.br/autenticacao",
"protocol": "https",
"host": [
"v2apitelemetria",
"telemetriastara",
"com",
"br"
],
"path": [
"autenticacao"
]
}
},
"response": []
},
{
"name": "Get Stara Tokens",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.environment.set(\"stara_access_token\", jsonData.X_access_token);",
"pm.environment.set(\"stara_refresh_token\", jsonData.refresh_Token);",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "accessTokenClient",
"value": "{{stara_access_token_client}}",
"type": "text"
},
{
"key": "apiKey",
"value": "{{stara_api_key}}",
"type": "text"
}
]
},
"url": {
"raw": "https://v2apitelemetria.telemetriastara.com.br/token",
"protocol": "https",
"host": [
"v2apitelemetria",
"telemetriastara",
"com",
"br"
],
"path": [
"token"
]
}
},
"response": []
}
]
},
{
"name": "Trimble auth",
"item": [
{
"name": "Get Trimble auth URL",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"application_name\": \"{{trimble_app_name}}\",\n \"client_id\": \"{{trimble_client_id}}\",\n \"client_redirect_url\": \"{{trimble_redirect_url}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{leaf_auth_trimble}}/get_url",
"protocol": "https",
"host": [
"{{leaf_auth_trimble}}"
],
"path": [
"get_url"
]