devnet-1128cisco intercloud fabric nb api's for business & providers
TRANSCRIPT
Intercloud FabricNorthbound APIs for Business
John McDonough
Intercloud Fabric Technical Marketing Engineer
DEVNET-1128
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Agenda
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 4
• Introduction
• Hands On
• Cisco Intercloud & Intercloud Fabric – Overview
• Intercloud Fabric APIs
• Conclusion
• Q & A
Agenda
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Introduction
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 6
Introduction – Session Information• Session: Cisco Intercloud Fabric NB Api's for Business
• Abstract: Get to know the latest Rest API's and their Capabilities for Intercloud Fabric Business. Understand how these API's can be used to integrate ICF into your Business Applications and provide the advantages of a true Hybrid Cloud to your end-users.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 7
Hands On
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 8
Hands On• 60 Day License for 10 VMs included in Intercloud Fabric Download
• Install and run with your Amazon AWS or Microsoft Azure provider accounts• Azure 30 day $200 credit works with Intercloud Fabric
• DevNet Sandbox• Test out the ICF APIs in DevNet sandbox• http://develper.cisco.com/cloud
• Cisco dCloud• Self-Paced lab covering all aspects of Intercloud Fabric• Running the latest release, offering the greatest flexibility • http://dcloud.cisco.com• Now Supporting ICF Release 2.2.1
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 9
Intercloud&
Intercloud Fabric
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Intercloud and Cisco Intercloud Fabric
INTERCLOUD
Public Clouds
EnterprisePrivateClouds
Intercloud Alliance
Intercloud Services
Intercloud Providers
Security
WebEx
DRaaS
IOE aaS
vDesktop aaS
HANA aaS
Analytics
Meraki
HCS
IaaS
Enterprise Workloads
Big Data and Analytics
Microsoft Suite aaS
PaaS
Native Cloud Applications
Collaboration and Video
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Intercloud Fabric Provider Platform
Intercloud Fabric for Providers
Intercloud Fabric Secure Extender(Secure Network Extension)
DC/Private Cloud
Provider Cloud
Cisco Intercloud Fabric Architectural Details
Intercloud Switch
VM Manager
Intercloud Fabric Services
Intercloud Extender
Intercloud Fabric
Director
End User and IT Admin PortalWorkload and Fabric ManagementIT AdminsEnd Users
VM VM
VM VMIntercloud Fabric
for Business
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Intercloud Fabric Structure
Cisco Intercloud Fabric Architecture is Modularized to Achieve the Elasticity Needed to Support Evolving Cloud Environments
ICF Core Infrastructure ICFD PNSC ICFPPSecure
Communications
Private Cloud: Enterprise Public Cloud: Provider
ICF Core ServicesSecurity Management
and VisibilityAutomationNetworking VM Portability
ICF Extended Services + External Partners (storage, load balancing, etc.)
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Security
ICF Core Services
ICF Core ServicesFundamental Service Functions and Capabilities Integrated Natively to ICF and its Operation
Management and Visibility
Automation and APIs
Networking
VM Portability
Switching, routing and other advanced network-based capabilities
VM to VM and App-to-App security controls
VM format conversion and mobility
Private and hybrid cloud monitoring capabilities
VM lifecycle capabilities, automated operations and Programmatic APIs
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
ICF Core Infrastructure
ICF Core Infrastructure
PNSC
ICFPP
Secure Communications
Enterprise tool to manage and orchestrate hybrid clouds
Enterprise Service orchestration function for privateand public services
Site-to-site and VM-to-VM communication technology
Cloud Provider Public Cloud management tool
Fundamental Technologies and Components That Support Intercloud Fabric Functions
Intercloud Fabric Director
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 15
Intercloud Fabric REST APIs
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 16
Intercloud Fabric REST APIs• Full VM lifecycle APIs
• Instantiation• Migration (convert move convert) less vendor specific tools• Power• Termination
• Consistent APIs across Cloud Providers• Many Clouds one API
• E.g. Power cycle call is the same for Provider A … Provider Z• Simplified scripts
• E.g. No special cases per provider
• REST Architecture
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 17
Intercloud FabricREST API URI Format
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
REST – What is it?• Representational State Transfer
• REST is an architectural style consisting of a coordinated set of architectural constraints applied to components, connectors, and data elements, within a distributed hypermedia system. REST ignores the details of component implementation and protocol syntax in order to focus on the roles of components, the constraints upon their interaction with other components, and their interpretation of significant data elements.
• Architectural Constraints• Client-Server / Stateless / Cacheable / Layered / Code on Demand (optional) / Uniform Interface• Identification of resources / Manipulation of resources / Self-descriptive / Hypermedia as the engine
of application state
• HTTP Vocabulary reuse• GET / POST / PUT / DELETE• The PUT and DELETE methods are idempotent methods. The GET method is a safe method (or
nullipotent), meaning that calling it produces no side-effects. POST is a create method.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 19
ICF REST API URI Format
• All Cisco ICFD REST APIs are GETs
• The URI structure for every REST call is the same• http|https://icfd-ip-addr/app/api/rest?
formatType=formattype&opName=opname&opData={param0:’value0’,…paramN:’valueN’}
• Required and Optional operators• formatType—(Optional) The output format type, either JSON or XML. JSON is the
default; if JSON is desired, you can omit formatType from the URI. • opName—(Required) The operation. • OpData—(Required when the operation requires data) The data for the operation
specified in JSON notation in the URI.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 20
ICF REST API URI Format
• To retrieve your login profile and receive JSON as the output format type• Use the following URI:https://icfd-ip-addr/app/api/rest?opName=userAPIGetMyLoginProfile
• JSON is the default
• For XML output, use the following URI:https://icfd-ip-addr/app/api/rest?formatType=xml&opName=userAPIGetMyLoginProfile
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 21
ICF REST API URI Format• For REST calls that require operational data, add the opData parameter
• opData parameters are numbered 0 to n
• To provision a VM, the following data elements are required for the opData parameter• catalogName, targetVdc, comment
• The URI for provisioning a VM from the • "AWS CentOS 63 Minimal 64 bit" catalog to the • "AWS-Engineering-Web" virtual data center, with the comment • "Engineering Web Server" would resemble the following:https://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIProvisionVM&opData={param0:'AWS CentOS 63 Minimal 64 bit',param1:'AWS-Engineering-Web',param2:'Engineering Web Server'}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 22
Intercloud FabricREST API
X-Cloupia-Request-Key
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 23
ICF REST API X-Cloupia-Request-Key
• Need to create the Header “X-Cloupia-Request-Key”• Get the keyhttps://icdf-ip-hostname/app/api/rest?"opName=getRESTKey&user=username&password=mypass
• F43955535D6148ADB742799BB20874C0
• Create the Header• X-Cloupia-Request-Key:F43955535D6148ADB742799BB20874C0
• All other operations will use the header as the authentication token
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 24
Intercloud FabricREST API Operations
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 25
ICF REST API Operations• User Operations
• getRESTKey – (admin/end user) See X-Cloupia-Request-Key earlier in this document• userAPIAddUser – (admin)
• userId, password, firstName, lastName, email, role, groupName• role choices: ‘Regular = Service End-User’, GroupAdmin = Group Admin’, ‘Admin = Service
Admin’https://icfd-ip-addr/app/api/rest?opName=userAPIAddUser&opData={param0:’userId',param1:’password',param2:’firstName',param3:’lastName',param4:’email',param5:’role',param6:’group’} - users
https://icfd-ip-addr/app/api/rest?opName=userAPIAddUser&opData={param0:’userId',param1:’password',param2:’firstName',param3:’lastName',param4:’email',param5:’role',param6:null} – admins
*group is null unquoted for admins
• Intercloud:userAPIResetUserPassword – (admin/end user)• userId• newPassword• resetAPIKey – boolen – values: true|falsehttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIResetUserPassword&opData={param0:’userId',param1:’newPassword',param2:false}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 26
ICF REST API Operations• User Operations – continued
• Intercloud:userAPIResetMyPassword – (admin/end user)• newPasswordhttps://icfd-ip-addr/app/api/rest?opName=userAPIResetMyPassword&opData={param0:’newPassword'}
• Intercloud:userAPIGetUserLoginProfile – (admin/end user)• userIdhttps://icfd-ip-addr/app/api/rest?opName=userAPIGetUserLoginProfile&opData={param0:’userId'}
• userAPIDeleteUser – (admin)• userIdopName=userAPIDeleteUser&opData={param0:’userId'}
• userAPIGetMyLoginProfile – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=userAPIGetMyLoginProfile
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 27
ICF REST API Operations• Catalog Operations
• userAPIGetAllCatalogs – (admin)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=userAPIGetAllCatalogs
• userAPIGetCatalogsPerGroup – (admin/end user – for their group)• groupNamehttps://icfd-ip-addr/app/api/rest?opName=userAPIGetCatalogsPerGroup&opData={param0:’groupName’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 28
ICF REST API Operations• Cloud Operations
• intercloud:userAPIGetAllVCenters – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=intercloud:userAPIGetAllVCenters
• Intercloud:userAPIGetAllDataCenters – (admin/end user)• vmManagerhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllDataCenters&opData={param0:’vmManager’}
• Intercloud:userAPIGetAllEsxHosts – (admin/end user)• vmManager• dataCenterhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllEsxHosts&opData={param0:’vmManager',param1:’dataCenter’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 29
ICF REST API Operations• Cloud Operations – continued
• Intercloud:userAPIgetStaticListByName – (admin)• dataStoreList this actual wordhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIgetStaticListByName&opData={param0:’dataStoreList’}
• Intercloud:userAPIGetAllicfClouds – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllicfClouds
• Intercloud:userAPIGetAllTunnelProfiles – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllTunnelProfiles
• Intercloud:userAPIGeticfCloudSummary – (admin)• icfCloudIdhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGeticfCloudSummary&opData={param0:’dataStoreList’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 30
ICF REST API Operations• Cloud Operations – continued
• Intercloud:userAPIGetAllDeviceProfiles – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllDeviceProfiles
• Intercloud:userAPIGetAllPvtDataTrunkPortProfiles – (admin/end user)• vmManager• dataCenterhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllPvtDataTrunkPortProfiles&opData={param0:’vmManager',param1:’dataCenter'}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 31
ICF REST API Operations• Network Operations
• Intercloud:userAPIcreateStaticIPPool – (admin)• policyName• staticIpPool – as a range e.g. 192.168.250.50-192.168.250.100• vlanId• gatewayIp• subnetMaskhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIcreateStaticIPPool&opData={param0:’policyName',param1:’staticIpPool',param2:’vlanId',param3:’gatewayIp',param4:’subnetMask’}
• Intercloud:userAPIcreateTunnelProfileWithDefaultValues – (admin)• tunnelProfileNamehttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIcreateTunnelProfileWithDefaultValues&opData={param0:’tunnelProfileName’}
• Intercloud:userAPIGetAllPvtMgmtPortProfiles – (admin/end user)• vmManager• dataCenterhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllPvtMgmtPortProfiles&opData={param0:’vmManager',param1:’dataCenter'}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 32
ICF REST API Operations• Network Operations - continued
• Intercloud:userAPIGetAllStaticIPPoolPolicy – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllStaticIPPoolPolicy
• Intercloud:userAPIGetAllStaticIPPools – (admin/end user)• policyIdhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllStaticIPPools&opData={param0:’policyId’}
• Intercloud:userAPIGetIPAddressPool – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetIPAddressPool
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 33
ICF REST API Operations• Service Request Operations
• userAPIGetServiceRequests – (admin/end user – for their SRs)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=userAPIGetServiceRequests
• userAPIGetServiceRequestDetails – (admin/end user – for their SRs)• requestIdhttps://icfd-ip-addr/app/api/rest?opName=userAPIGetServiceRequestDetails&opData={param0:’requestId’}
• userAPIGetVMsForServiceRequest– (admin/end user – for their SRs)• requestIdhttps://icfd-ip-addr/app/api/rest?opName=userAPIGetVMsForServiceRequest&opData={param0:’requestId’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 34
ICF REST API Operations• VDC Operations
• userAPIGetAllVDCs – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=userAPIGetAllVDCs
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 35
ICF REST API Operations• VM Operations
• Note in all API calls vmId refers to the vmId number in ICF, except Intercloud:userAPIOnboardVM where vmId is the AWS ‘Instance ID’
• Intercloud:userAPIGetAllVms – (admin/end user)• No opDatahttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetAllVms
• Intercloud:userAPIGetVMSummary – (admin/end user – for their VMs)• vmIdhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetVMSummary&opData={param0:’vmId’}
• Intercloud:userAPIGetVMVnics – (admin/end user – for their VMs)• vmIdhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIGetVMVnics&opData={param0:’vmId’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 36
ICF REST API Operations• VM Operations – continued
• Intercloud:userAPIProvisionVM – (admin/end user)• catalogName• targetVdc• commenthttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIProvisionVM&opData={param0:’catalogName',param1:targetVdc',param2:’comment’}
• Intercloud:userAPIOnboardVM – (admin/end user) – AWS only• vmId - The identifier, in the format i-xxxx, of the VM instance running on the Amazon cloud• vmName - The name of the VM• targetVdc - The name of the target VDC• AppCategory - The Application Category in the VDC to assign to the VM• OS - The operating system in the form OS_version_architecture, such as CentOS_6.2_64bithttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIOnboardVM&opData={param0:’vmId',param1:vmName',param2:’targetVdc’,param3:’ AppCategory’,param4:’OS’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 37
ICF REST API Operations• VM Operations – continued
• Intercloud:userAPIMoveVMToCloud – (admin/end user – for their VMs)• vmId• vmName• targetVdc• comment• removeSource – boolean – values: true|false
https://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIMoveVMToCloud&opData={param0:’vmId',param1:vmName',param2:’targetVdc’,param3:’comment’,param4:’removeSource’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 38
ICF REST API Operations• VM Operations – continued
• Intercloud:userAPIMoveVMToEnterprise – (admin/end user – for their VMs)• vmId• vmName• targetVdc• ipAddress – IP address of destination Hypervisor host• datastoreName – Private cloud datastore where VM will reside• comment• removeSource – boolean – values: true|false
https://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIMoveVMToEnterprise&opData={param0:’vmId',param1:vmName',param2:’targetVdc’,param3:’ ipAddress’,param4:’datastoreName’,param5:’comment’,param6:’removeSource’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 39
ICF REST API Operations• VM Operations – continued
• Intercloud:userAPIVmPowerOff – (admin/end user)• vmdhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIVmPowerOff&opData={param0:’vmId’}
• Intercloud:userAPIVmPowerOn – (admin/end user)• vmIdhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIVmPowerOn&opData={param0:’vmId’}
• Intercloud:userAPIVmReboot – (admin/end user)• Vmdhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIVmReboot&opData={param0:’vmId’}
• Intercloud:userAPIVmTerminate – (admin/end user)• vmIdhttps://icfd-ip-addr/app/api/rest?opName=Intercloud:userAPIVmTerminate&opData={param0:’vmId’}
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Conclusion
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Q & A
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Intercloud Fabric @ CiscoLive San Diego
Breakouts
TECCLD-3001 Sun 8:00 4 hrs 16B Mezz Intercloud Fabric Technical Deepdive
PSOCLD-1001 Mon 11:00 60 min 14B Mezz Hybrid Cloud with Intercloud Fabric
PSODCT-1009 Mon 2:00 60 min 14B Mezz Hybrid Clouds: Integrating the Enterprise Data Center and Public Cloud
BRKCLD-2003 Wed 8:00 2 hrs 7A Upper Building Hybrid Cloud Applications with Intercloud Fabric
BRKCLD-1828 Thu 8:00 90 min 25C Upper Designing Hybrid Cloud operations with ServiceGrid and Intercloud Fabric
DevNet
DEVNET-1008 Mon 9:00 30 min Devnet Theater Private or Public or Hybrid ? Which Cloud Should I choose?
DEVNET-1120 Mon 1:00 60 min Devnet Classrm #2 Intercloud Fabric - AWS and Azure Account Setup and Utilization
DEVNET-1128 Mon 2:00 30 min Devnet Classrm #2 Cisco Intercloud Fabric NB APIs for Business
DEVNET-1009 Tue 9:00 30 min Devnet Theater Cisco Intercloud Fabric for Business, Helping Enterprises Move to Hybrid!
DEVNET-2009 Wed 12:00 30 min Devnet Classrm #2 Intercloud Fabric REST APIs for Providers World of Solutions Learning Labs Table Topics Meet the EngineerICF in Hybrid Cloud
Mon 12:00Table #11
Wed 11:30Table #13
Building Hybrid Cloud Apps with ICF
Tue 11:30Table # 11
Wed 11:30Table #10
Talk to an ICF Expert @ ‘The Hub’
Ground Level
See ICF in action with 3-tier hybrid cloud application
‘Cloud’ Booth in WoS, Ground Level
Hands on with ICF:‘Intercloud Fabric Learning Lab’
‘DevNet Zone’ Ground Level
cisco.com/go/intercloudfabric
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 43
Participate in the “My Favorite Speaker” Contest
• Promote your favorite speaker through Twitter and you could win $200 of Cisco Press products (@CiscoPress)
• Send a tweet and include • Your favorite speaker’s Twitter handle johnamcdonough• Two hashtags: #CLUS #MyFavoriteSpeaker
• You can submit an entry for more than one of your “favorite” speakers
• Don’t forget to follow @CiscoLive and @CiscoPress
• View the official rules at http://bit.ly/CLUSwin
Promote Your Favorite Speaker and You Could Be a Winner
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
Complete Your Online Session Evaluation
Don’t forget: Cisco Live sessions will be available for viewing on-demand after the event at CiscoLive.com/Online
• Give us your feedback to be entered into a Daily Survey Drawing. A daily winner will receive a $750 Amazon gift card.
• Complete your session surveys though the Cisco Live mobile app or your computer on Cisco Live Connect.
44
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 45
Continue Your Education• Demos in the Cisco campus
• Walk-in Self-Paced Labs
• Table Topics
• Meet the Engineer 1:1 meetings
• Related sessions
Thank you
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 46
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128 48
JSON & XML Reference
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
REST – What is it?• Representational State Transfer
• REST is an architectural style consisting of a coordinated set of architectural constraints applied to components, connectors, and data elements, within a distributed hypermedia system. REST ignores the details of component implementation and protocol syntax in order to focus on the roles of components, the constraints upon their interaction with other components, and their interpretation of significant data elements.
• Architectural Constraints• Client-Server / Stateless / Cacheable / Layered / Code on Demand (optional) / Uniform Interface• Identification of resources / Manipulation of resources / Self-descriptive / Hypermedia as the engine
of application state
• HTTP Vocabulary reuse• GET / POST / PUT / DELETE• The PUT and DELETE methods are idempotent methods. The GET method is a safe method (or
nullipotent), meaning that calling it produces no side-effects. POST is a create method.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
JSON – What is it?• JSON (JavaScript Object Notation) is a lightweight data-interchange format.
• It is easy for humans to read and write.
• It is easy for machines to parse and generate.
• It is based on a subset of the JavaScript Programming Language
• JSON is a text format that is completely language independent
• Uses conventions that are familiar to programmers (or just people)
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
JSON – Structures• JSON is built on two structures:
• Object – A collection of name/value pairs.• Programming language representations – record, struct, dictionary, hash table, keyed
list, or associative array.
• Array – An ordered list of values.• Programming language representations – array, vector, list, or sequence.
• These are universal data structures. Virtually all modern programming languages support them in one form or another.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
JSON Structure Forms – Object• Object
• An object is an unordered set of name/value pairs.• An object begins with { (left brace) and ends with } (right brace).• Each name is followed by : (colon) • name/value pairs are separated by , (comma).
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
JSON Structure Forms – Array• Array
• An array is an ordered collection of values.• An array begins with [ (left bracket) and ends with ] (right bracket).• Values are separated by , (comma).
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
JSON – Values• A value can be a string in double quotes, or a number, or true or false or null, or
an object or an array. These structures can be nested.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
JSON – String• A string is a sequence of zero or more Unicode characters, wrapped in double
quotes, using backslash escapes.
• A character is represented as a single character string.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
JSON – Number• A number is very much like a C or Java number, except that the octal and
hexadecimal formats are not used.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
• object
• {} / {members}
• members
• pair / pair , members
• pair
• string : value
• array
• [] / [ elements ]
• elements
• value – or – value , elements
• value
• string
• number
• object
• array
• true
• false
• null
• string
• “”
• “ chars ”
• chars
• char
• char chars
• char
• any-Unicode-character- except-"-or- \ -or- control-character
• \“
• \\
• \/
• \b
• \f
• \n
• \r
• \t
• \u four-hex-digits
• number
• int / int frac / int exp / int frac exp
• int
• digit / digit1-9 digits
• - digit / - digit1-9 digits
• frac
• . digits
• exp
• e digits
• digits
• digit / digit digits
• e
• E
• e+
• e-
• E
• E+
• E-
JSON - Structures • Strings • Numbers
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
XML – What is it?• XML stands for eXtensible Markup Language
• XML was designed to carry data, not to display data
• XML tags are not predefined. You must define your own tags!!!
• XML is designed to be self-descriptive
• XML is a W3C Recommendation
• XML is a markup language much like HTML
• XML is not a replacement for HTML.• XML was designed to transport and store data, with focus on what data is• HTML was designed to display data, with focus on how data looks• HTML is about displaying information, while XML is about carrying information.
• XML does not do anything, sorry
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
XML – Basic Document Structure• Element tags
• Elements can have associated attributes
• Attributes• Attributes have values
• Text content (not in APIC)
• Miscellaneous• Encoding, document type declarations• Entity references• Comments, processing instructions, etc…
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
XML – Basic Document Structure• XML components
1 <?xml version=‘1.0’ encoding=‘UTF-8’?> XML Declaration2 <!DOCTYPE order SYSTEM ‘order.dtd’> Document Type
Declaration3 <?xml-stylesheet type=‘text/xsl’ href=‘style.xsl’?> Processing Instructions4 <order> Element Tags
5 <item code=‘BK123’> Element Attributes
6 <name>Jonathan Strange and Mr. Norrell</name> Attribute Values
7 <price currency=‘USD’ student_discount=‘20%’>42.00</price> Text Content
8 </item>
9 </order>
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicDEVNET 1128
XML – Proper Format• Elements must be balanced, properly nested
• e.g. <br /> OK• e.g. <b>bold <i> and italic </i> text</b> OK• e.g. <b>bold <i> and italic </b> text</i> BAD!• e.g. <ul> <li> list item </ul> BAD!
• Attributes must be specified, quoted• e.g. <img src=‘images/banner.gif’/> OK• e.g. <img src=images/banner.gif /> BAD!• e.g. <ul compact> <li> list item </li> </ul> BAD!