the powerof rest api - vcdx211.files.wordpress.com · beyond rest api rest api bestpractices quiz...
TRANSCRIPT
![Page 1: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/1.jpg)
12-12-2017
© Atos
The power of Rest API
Olena Zhuk and Konrad Cłapa
![Page 2: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/2.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Who are we?▶ How to start your journey?▶ What is REST API?▶ VMware REST API?▶ Beyond REST API▶ Rest API best practices▶ Quiz with gifts▶ QA
Agenda
![Page 3: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/3.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Technical Engineer @ Atos IT Services▶ Private Cloud Lead Developer▶ [email protected]
Who are we – Olena Zhuk
![Page 4: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/4.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Global Technical Architect @ Atos IT Services▶ Private Cloud Developer▶ Double VCDX #211▶ vcdx211.wordpress.com▶ @clapa_konrad
Who are we – Konrad Cłapa
![Page 5: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/5.jpg)
How to start the journey?
![Page 6: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/6.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Watch this presentation▶ Bookmark code.vmware.com▶ Watch vBrownBags API zero to hero▶ Download Postman and play with your own lab and 3rd party APIs▶ Run Hands on Labs
6
How to start your journey?
![Page 7: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/7.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Change mindset▶ The power of REST API▶ When to use REST API
7
Key Takeaways
![Page 8: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/8.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Application Programming Interface▶ communication interface between computer programs which is built based on
REST architectural principles▶ HTTP network communication (most often)▶ mapping CRUD operations (most often)▶ stateless▶ pointing to further resources (should be, not always implemented correctly)▶ payload is NOT restricted to specific format
8
What is RESTful API
![Page 9: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/9.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Used for transmission of data between systems that are platform independent
9
What is RESTful API – make it simple
![Page 10: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/10.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ POSTMAN▶ SoapUI▶ vRO▶ CURL▶ Powershell▶ Python▶ any programming language
10
How to use REST API
![Page 11: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/11.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Endpoint (URI)▶ Resource/Entity▶ Method ▶ Header▶ Body
11
Rest API call
![Page 12: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/12.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ GET – retrieve an entity by URI▶ PUT – overwrite an entity▶ POST – append child entity to one identified by URI▶ DELETE – delete resource identified by URI
12
Rest API methods (headlights)
![Page 13: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/13.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 13
![Page 14: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/14.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 14
Common responses
![Page 15: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/15.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 15
REST API vs SOAP
SOAP RESTXML JSON, XML, BinaryAccess to services Access to resourcesStateful StatelessBuilt-in retry logic CachingComplex operations Simple actionsMore complicate to implement Easier in use and implementation
![Page 16: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/16.jpg)
Authentication
16
![Page 17: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/17.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Basic – NSX– vRO
▶ Oauth 2.0– vSphere– vRA– vRO– vROPs
17
Authentication
![Page 18: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/18.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 18
Basic authentication
![Page 19: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/19.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 19
Oauth 2.0
![Page 20: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/20.jpg)
vSphere 6.5 REST API
20
![Page 21: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/21.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Brand new!▶ Swagger API Explorer
21
vSphere 6.5 Rest API
![Page 22: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/22.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
DEMO TIME!
22
![Page 23: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/23.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
https://code.vmware.com/apis/176/vro-resthttps://code.vmware.com/apis/39/vrealize-automation
23
vRA/vRO Rest API
![Page 24: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/24.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 24
vRO REST API
![Page 25: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/25.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 25
vRO REST API
![Page 26: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/26.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 26
vRO REST API
![Page 27: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/27.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 27
vRA REST API
![Page 28: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/28.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 28
![Page 29: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/29.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ https://docs.vmware.com/en/VMware-NSX-for-vSphere/6.3/nsx_63_api.pdf
29
NSX Rest API
![Page 30: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/30.jpg)
Could that be donesimpler?
![Page 31: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/31.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Almost as powerful as Rest API▶ Easier to use▶ Not always up to date▶ Most popular modules:– PowerCLI– PowerVRA– PowerVRO– PowerNSX
Powershell modules
![Page 32: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/32.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
VMware PowerCLI is a command-line and scripting tool built on Windows PowerShell, and provides more than 600 cmdlets for managing and automating vSphere, vCloud, vRealize Operations Manager, vSAN, NSX-T, VMware Cloud on AWS, and VMware Horizon environments.
▶ Install▶ Connect-VIServer▶ Rule it all!
32
PowerCLIVMware Supported
![Page 33: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/33.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Open projects on Github▶ Mimics the way PowerCLI works
33
PowerXCreated by community
![Page 34: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/34.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Invoke-WebRequest and Invoke-RestMethod from Microsoft.PowerShell.Commands.Utility
34
PowerVROCommunity supported
![Page 35: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/35.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Powershell wrapperfor vRA REST API
▶ Popular module for vRA automation
35
PowerVRACommunity supported
![Page 36: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/36.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ Not only command-letes▶ Contains some analysis
tools▶ Includes operations from
Cross-vCenter NSX
36
PowerNSXComminuty supported+
![Page 37: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/37.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering 37
vRO Plugins
![Page 38: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/38.jpg)
Best Practices
38
![Page 39: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/39.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
Best practices
▶ Map rest responses to your error handling▶ Use one method to deal with resource▶ Use http encoding for special characters▶ Be careful about case-sensitivity▶ Use one media type▶ Develop one method for response parsing and managing retrieved resources▶ Develop common wrapper for creating REST calls▶ Get resource before modifying it to avoid conflicts
![Page 40: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/40.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ https://code.vmware.com/web/dp/tool/vmware-powercli/6.5.4▶ https://vbrownbag.com/vbrownbag-technology-series/api-zero-to-hero/▶ https://github.com/jakkulabs/PowervRA▶ https://github.com/jakkulabs/PowervRO▶ https://powernsx.github.io/▶ https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/products/nsx/vmware-automating-
vsphere-with-powernsx.pdf
40
References
![Page 41: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/41.jpg)
QUIZ
41
![Page 42: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/42.jpg)
QA
![Page 43: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/43.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ What are 4 most often used REST API methods?
43
Question 1
![Page 44: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/44.jpg)
| 12-12-2017 | BG, KC | © Atos Cloud Services | Engineering
▶ What are 2 authentication methods used by VMware products?
44
Question 2
![Page 45: The powerof Rest API - vcdx211.files.wordpress.com · Beyond REST API Rest API bestpractices Quiz with gifts QA Agenda | 12-12-2017 | BG, KC | © Atos ... Application Programming](https://reader031.vdocuments.us/reader031/viewer/2022013114/5b8777c37f8b9a46538b7eac/html5/thumbnails/45.jpg)
Thank You!