%PDF-1.7
%
832 0 obj
<>/Metadata 883 0 R/Pages 829 0 R/StructTreeRoot 109 0 R/Type/Catalog/ViewerPreferences 847 0 R>>
endobj
872 0 obj
<>/Font<>>>/Fields[]>>
endobj
883 0 obj
<>stream
11.0
8.5
16
2019-05-21T12:01:09.772-04:00
Microsoft® Word for Office 365
Steven Major
7af37d341681c9da7457cad81346fcf69cd23ec5
294841
REST API LUA HTTP
Microsoft® Word for Office 365
<p>Making HTTP requests to interface with a REST API is a common necessity in modern programming. Doing this from within a SAS® program can be cumbersome. Making a simple get request requires the user to write header and body files, parse any URL parameters, and pass this information along to PROC HTTP. Authentication further complicates the problem. Once requests are made, the response needs to be somehow read in a way that is useful to the SAS programmer. This process often requires that the user be able to parse JavaScript Object Notation (JSON) strings to extract data before storing them in a SAS data set or local database. In this paper, we show how users can create Lua modules that simplify these tasks and, by using PROC LUA, how you can use these modules to easily interface with a REST API from SAS. We also show how debugging functionality can be worked into these modules and used to troubleshoot request errors. As specific examples, we demonstrate how to retrieve online climate data from the National Oceanic and Atmospheric Administration and how to interact with SAS® Risk and Finance Workbench programmatically. </p>
<p>Steven Major, SAS Institute Inc. </p>
<p style="font-family: Arial,Helvetica,sans-serif; font-size: 90%; line-height: 300%; margin: -3em 0em 2em 0em;"><a href="https://github.com/sascommunities/sas-global-forum-2019">Access sample code</a></p>
<p> </p>
Session 3113
en
regis.white@sas.com
<p>Making HTTP requests to interface with a REST API is a common necessity in modern programming. Doing this from within a SAS® program can be cumbersome. Making a simple get request requires the user to write header and body files, parse any URL parameters, and pass this information along to PROC HTTP. Authentication further complicates the problem. Once requests are made, the response needs to be somehow read in a way that is useful to the SAS programmer. This process often requires that the user be able to parse JavaScript Object Notation (JSON) strings to extract data before storing them in a SAS data set or local database. In this paper, we show how users can create Lua modules that simplify these tasks and, by using PROC LUA, how you can use these modules to easily interface with a REST API from SAS. We also show how debugging functionality can be worked into these modules and used to troubleshoot request errors. As specific examples, we demonstrate how to retrieve online climate data from the National Oceanic and Atmospheric Administration and how to interact with SAS® Risk and Finance Workbench programmatically. </p>
<p>Steven Major, SAS Institute Inc. <br>
</p>
Microsoft® Word for Office 365
2019-05-17T09:03:27.000-04:00
2019-05-17T09:03:27.000-04:00
2019-04-09T14:29:10.000-04:00
application/pdf
REST API LUA HTTP
2019-05-21T12:01:09.803-04:00
Steven Major
Making HTTP requests to interface with a REST API is a common necessity in modern programming. Doing this from within a SAS® program can be cumbersome. Making a simple get request requires the user to write header and body files, parse any URL parameters, and pass this information along to PROC HTTP. Authentication further complicates the problem. Once requests are made, the response needs to be somehow read in a way that is useful to the SAS programmer. This process often requires that the user be able to parse JavaScript Object Notation (JSON) strings to extract data before storing them in a SAS data set or local database. In this paper, we show how users can create Lua modules that simplify these tasks and, by using PROC LUA, how you can use these modules to easily interface with a REST API from SAS. We also show how debugging functionality can be worked into these modules and used to troubleshoot request errors. As specific examples, we demonstrate how to retrieve online climate data from the National Oceanic and Atmospheric Administration and how to interact with SAS® Risk and Finance Workbench programmatically.
Steven Major, SAS Institute Inc.
REST Easier with SAS®: Using the LUA Procedure to Simplify REST API Interactions
uuid:584DB039-AAA1-4938-A35C-6CACF5AA99D8
uuid:e398562b-9d6c-4804-9629-f7901bb4f870
sas
year:2019
support:sgf-papers
support:sgf-papers/topic/programming/open-integration
software:BASE
support:customer-roles/programmer
event-type:180/session-type/breakout
endstream
endobj
829 0 obj
<>
endobj
109 0 obj
<>
endobj
847 0 obj
<>
endobj
110 0 obj
<>
endobj
111 0 obj
<>
endobj
112 0 obj
[165 0 R 166 0 R 167 0 R 168 0 R 169 0 R 170 0 R 171 0 R 794 0 R 828 0 R 795 0 R 173 0 R 174 0 R 175 0 R 176 0 R 177 0 R 178 0 R]
endobj
113 0 obj
<>
endobj
114 0 obj
[179 0 R 180 0 R 791 0 R 826 0 R 792 0 R 824 0 R 793 0 R 182 0 R 183 0 R 184 0 R 185 0 R 186 0 R 187 0 R 188 0 R 189 0 R 190 0 R 191 0 R 192 0 R 193 0 R 194 0 R 195 0 R 196 0 R 197 0 R 198 0 R 199 0 R 200 0 R 201 0 R 202 0 R 203 0 R 204 0 R 205 0 R 206 0 R 207 0 R 208 0 R 209 0 R 210 0 R 211 0 R 212 0 R 213 0 R 214 0 R 215 0 R 216 0 R 217 0 R 218 0 R]
endobj
115 0 obj
<>
endobj
116 0 obj
<>
endobj
117 0 obj
[219 0 R 220 0 R 221 0 R 222 0 R 223 0 R 224 0 R 225 0 R 226 0 R 227 0 R 228 0 R 229 0 R 230 0 R 231 0 R 232 0 R 233 0 R 234 0 R 235 0 R 236 0 R 237 0 R 238 0 R 239 0 R 240 0 R 241 0 R 242 0 R 243 0 R 244 0 R 245 0 R 246 0 R 247 0 R 248 0 R 249 0 R 250 0 R 251 0 R 252 0 R 253 0 R 254 0 R 255 0 R 256 0 R 257 0 R 258 0 R 259 0 R 260 0 R 261 0 R 262 0 R 263 0 R 264 0 R 265 0 R]
endobj
118 0 obj
[266 0 R 267 0 R 268 0 R 269 0 R 270 0 R 271 0 R 272 0 R 273 0 R 274 0 R 275 0 R 276 0 R 277 0 R 278 0 R 279 0 R 280 0 R 281 0 R 282 0 R 283 0 R 284 0 R 285 0 R 286 0 R 287 0 R 288 0 R 289 0 R 290 0 R 291 0 R 292 0 R 293 0 R 294 0 R 295 0 R 296 0 R 297 0 R 298 0 R 299 0 R 300 0 R 301 0 R 302 0 R 303 0 R 304 0 R 305 0 R 306 0 R 307 0 R 308 0 R 309 0 R 310 0 R 311 0 R 312 0 R 313 0 R 314 0 R 315 0 R]
endobj
119 0 obj
[316 0 R 787 0 R 822 0 R 788 0 R 820 0 R 789 0 R 818 0 R 790 0 R 318 0 R 319 0 R 320 0 R 321 0 R 322 0 R 323 0 R 324 0 R 325 0 R 326 0 R 327 0 R 328 0 R 329 0 R 330 0 R 331 0 R 332 0 R 333 0 R 334 0 R 335 0 R 336 0 R 337 0 R 338 0 R 339 0 R 340 0 R 341 0 R 342 0 R 343 0 R 344 0 R 345 0 R 346 0 R 347 0 R]
endobj
120 0 obj
<>
endobj
121 0 obj
<>
endobj
122 0 obj
<>
endobj
123 0 obj
[348 0 R 349 0 R 350 0 R 351 0 R 352 0 R 353 0 R 354 0 R 355 0 R 356 0 R 357 0 R 358 0 R 359 0 R 360 0 R 361 0 R 362 0 R 363 0 R 364 0 R 365 0 R 366 0 R 367 0 R 368 0 R 369 0 R 370 0 R 371 0 R 372 0 R 373 0 R 374 0 R 375 0 R 376 0 R 377 0 R 378 0 R 379 0 R 380 0 R 381 0 R 382 0 R 383 0 R 384 0 R 385 0 R 386 0 R 387 0 R 388 0 R 389 0 R 390 0 R 391 0 R 392 0 R 393 0 R 394 0 R 395 0 R 396 0 R 397 0 R 398 0 R 399 0 R 400 0 R]
endobj
124 0 obj
[401 0 R 402 0 R 403 0 R 404 0 R 405 0 R 406 0 R 407 0 R 408 0 R 409 0 R 410 0 R 411 0 R 412 0 R 413 0 R 414 0 R 415 0 R 416 0 R 417 0 R 418 0 R 419 0 R 420 0 R 421 0 R 422 0 R 423 0 R 424 0 R 425 0 R 426 0 R 427 0 R 428 0 R 429 0 R 430 0 R 431 0 R 432 0 R 433 0 R 434 0 R 435 0 R 436 0 R 437 0 R 438 0 R 439 0 R 440 0 R 441 0 R]
endobj
125 0 obj
[442 0 R 443 0 R 444 0 R 445 0 R 446 0 R 447 0 R 448 0 R 449 0 R 450 0 R 451 0 R 452 0 R 453 0 R 454 0 R 455 0 R 456 0 R 457 0 R 458 0 R 459 0 R 460 0 R 461 0 R 462 0 R 463 0 R 464 0 R 465 0 R 466 0 R 467 0 R 468 0 R 469 0 R 470 0 R 471 0 R 472 0 R 473 0 R 474 0 R 475 0 R 476 0 R 477 0 R 478 0 R 479 0 R 480 0 R 481 0 R 482 0 R 483 0 R 484 0 R 485 0 R 486 0 R]
endobj
126 0 obj
[487 0 R 488 0 R 489 0 R 490 0 R 491 0 R 492 0 R 493 0 R 494 0 R 495 0 R 496 0 R 497 0 R 498 0 R 785 0 R 815 0 R 786 0 R 500 0 R 500 0 R 501 0 R 501 0 R 502 0 R 502 0 R 503 0 R 503 0 R 504 0 R 504 0 R 505 0 R 505 0 R 506 0 R 507 0 R 507 0 R 508 0 R 509 0 R 509 0 R 510 0 R 510 0 R 511 0 R 511 0 R 512 0 R 513 0 R 514 0 R 514 0 R 515 0 R 515 0 R 516 0 R 783 0 R 813 0 R 784 0 R 518 0 R 519 0 R 520 0 R 781 0 R 811 0 R 782 0 R]
endobj
127 0 obj
<>
endobj
128 0 obj
<>
endobj
129 0 obj
<>
endobj
130 0 obj
<>
endobj
131 0 obj
[808 0 R 780 0 R 523 0 R 524 0 R 525 0 R 526 0 R 527 0 R 528 0 R 529 0 R 530 0 R 531 0 R 532 0 R 533 0 R 534 0 R 535 0 R 536 0 R 537 0 R 538 0 R 539 0 R 540 0 R 541 0 R 542 0 R 543 0 R 544 0 R 545 0 R 546 0 R 547 0 R 548 0 R 549 0 R 550 0 R 551 0 R 552 0 R 553 0 R 554 0 R 555 0 R 556 0 R 778 0 R 807 0 R 779 0 R 558 0 R]
endobj
132 0 obj
<>
endobj
133 0 obj
[559 0 R 560 0 R 561 0 R 562 0 R 563 0 R 564 0 R 565 0 R 566 0 R 567 0 R 568 0 R 569 0 R 570 0 R 571 0 R 572 0 R 573 0 R 574 0 R 575 0 R 576 0 R 577 0 R 578 0 R 579 0 R 580 0 R 581 0 R 582 0 R 583 0 R 584 0 R 585 0 R 586 0 R 776 0 R 804 0 R 777 0 R 588 0 R 589 0 R 590 0 R 591 0 R 592 0 R 593 0 R 594 0 R 595 0 R 596 0 R]
endobj
134 0 obj
<>
endobj
135 0 obj
[597 0 R 598 0 R 599 0 R 600 0 R 601 0 R 602 0 R 603 0 R 604 0 R 605 0 R 606 0 R 607 0 R 608 0 R 609 0 R 610 0 R 611 0 R 612 0 R 613 0 R 614 0 R 615 0 R 616 0 R 617 0 R 618 0 R 619 0 R 620 0 R 621 0 R 622 0 R 623 0 R 624 0 R 625 0 R 626 0 R 627 0 R 628 0 R 629 0 R 630 0 R 631 0 R 632 0 R 633 0 R 634 0 R 635 0 R 636 0 R 637 0 R 638 0 R 639 0 R 640 0 R 641 0 R 642 0 R 643 0 R 644 0 R 645 0 R]
endobj
136 0 obj
[646 0 R 647 0 R 648 0 R 649 0 R 650 0 R 651 0 R 652 0 R 653 0 R 654 0 R 655 0 R 656 0 R 657 0 R 658 0 R 659 0 R 660 0 R 661 0 R 662 0 R 663 0 R 664 0 R 665 0 R 665 0 R 666 0 R 666 0 R 667 0 R 667 0 R 668 0 R 668 0 R 669 0 R 670 0 R 670 0 R 671 0 R 672 0 R 672 0 R 673 0 R 673 0 R 674 0 R 675 0 R 675 0 R 676 0 R 676 0 R 677 0 R 677 0 R 678 0 R 679 0 R 679 0 R 680 0 R 680 0 R 681 0 R 682 0 R 682 0 R 683 0 R 683 0 R 684 0 R 685 0 R 686 0 R 687 0 R]
endobj
137 0 obj
[688 0 R 689 0 R 690 0 R 691 0 R 692 0 R 693 0 R 694 0 R 695 0 R 696 0 R 697 0 R]
endobj
138 0 obj
[698 0 R 699 0 R 699 0 R 700 0 R 700 0 R 701 0 R 701 0 R 772 0 R 773 0 R 802 0 R 774 0 R 800 0 R 775 0 R 771 0 R 771 0 R 770 0 R 770 0 R 704 0 R 704 0 R 766 0 R 766 0 R 706 0 R 706 0 R 706 0 R 706 0 R 763 0 R 763 0 R 708 0 R 708 0 R 760 0 R 760 0 R 710 0 R 710 0 R 711 0 R 711 0 R 712 0 R 712 0 R 757 0 R 757 0 R 756 0 R 756 0 R 714 0 R 714 0 R 715 0 R 715 0 R 716 0 R 716 0 R 752 0 R 752 0 R 751 0 R 751 0 R 750 0 R 750 0 R 718 0 R 718 0 R 745 0 R 745 0 R 744 0 R 744 0 R]
endobj
139 0 obj
<>
endobj
140 0 obj
<>
endobj
141 0 obj
[142 0 R 142 0 R 143 0 R 143 0 R 144 0 R 144 0 R 145 0 R 145 0 R 146 0 R 146 0 R 147 0 R 147 0 R 148 0 R 149 0 R 150 0 R 150 0 R 151 0 R 151 0 R 152 0 R 153 0 R 154 0 R 154 0 R 155 0 R 155 0 R 156 0 R 156 0 R 157 0 R 157 0 R 158 0 R 158 0 R 159 0 R 159 0 R 160 0 R 160 0 R]
endobj
142 0 obj
<>
endobj
143 0 obj
<>
endobj
144 0 obj
<>
endobj
145 0 obj
<>
endobj
146 0 obj
<>
endobj
147 0 obj
<>
endobj
148 0 obj
<>
endobj
149 0 obj
<>
endobj
150 0 obj
<>
endobj
151 0 obj
<>
endobj
152 0 obj
<>
endobj
153 0 obj
<>
endobj
154 0 obj
<>
endobj
155 0 obj
<>
endobj
156 0 obj
<>
endobj
157 0 obj
<>
endobj
158 0 obj
<>
endobj
159 0 obj
<>
endobj
160 0 obj
<>
endobj
161 0 obj
<>
endobj
35 0 obj
<>/MediaBox[0 0 612 792]/Parent 829 0 R/Resources<>/Font<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Rotate 0/StructParents 31/Tabs/S/Type/Page>>
endobj
36 0 obj
<>stream
x\Mo9{fb0ıg3r ˲e-e$[nIvOQPj z"U#h܈;xj,~I~s"sx6B 6b19<<<8>Ӣ7V)ijᬬ_.}Uս@
rСC\~_;/H c!$N;7Bu>RǪr"*'Y{Mݛv%*܋0䨍7rttg+w% CpWGU ]LJWܗGR+@>E3l#5'ʣP\MЖ{+92IpUV`.m13SNຖA瀿zGx*j]|Y=XfV:gĎaJyeDWG~v7ղy|lة2@'7e,0J{.uz.c ֘vZ4cd mphȀX!27FB?Kw!wTΝ$(|ؑ)|-B\kb˻Xyϱ]"cU6jKwi=]ڀPNG6טih0@"::\PV{xcg~OrhNZ
>[9Scf}6xXYzB5Fv.@]%0Btkr
lZxP+sTK'|Pgh)#5\h%W>&f<偣M%=R}Ld"2m !&
݆+S*H[Fyi|Δd"AĽ6\1]g^6zc)1;
ɀT\,WuDI%c[w_cm3nZǐ5
Pl1b5L5Q
so$ A:*$Nq˙8bBmoMmR
Ԟul.y328OqA:IIF/}yR/VFr5eeKeTX-ڥ8c9NO,Aaթ(`;
8DWᔌ9BLV9lBC{r8gI_sԸi[Y.\
SW_Kڥ.3
L&:;=L)ӓ*@]/C.J.0/KJEee`i* hh@vܧ3_-{NǷĊg]>}xilzNJJj%)wO,=xQ}]Ṃg@8όv1²lڝ#D|ȸdS9h7 9уh7w1nnVU6M
=cڬ$AWჄyyo#m&g6`.ǫ$mh3~}{(.9UE=1Jr_j~]+.qۂq.u8f܃q1n.,1
8
xeC'2y߇DLIEwJgxwſ? 8H@}xf#I(}#$N#'-=C[%[IMɊx>ܣ>MiT;v{4RSgúOV~[PE/g+]0"VA;;oO;e{