Dell PowerSwitch S4112F-ON OS10 Enterprise Edition User Guide Release 10.4.1.0 - Page 788
RESTCONF API tasks, View XML structure of CLI commands
View all Dell PowerSwitch S4112F-ON manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 788 highlights
RESTCONF API tasks Using the RESTCONF API, you can provision OS10 switches using HTTPS requests. The examples in this section show how to access the OS10 RESTCONF API using curl commands. curl is a Linux shell command that generates HTTPS requests and is executed on an external server. curl Commands curl command options include: • -X specifies the HTTPS request type; for example, POST , PATCH, or GET. • -u specifies the user name and password to use for server authentication. • -k specifies a text file to read curl arguments from. The command line arguments found in the text file will be used as if they were provided on the command line. Use the IP address or URL of the OS10 switch when you access the OS10 RESTCONF API from a remote orchestration system. • -H specifies an extra header to include in the request when sending HTTPS to a server. You can enter multiple extra headers. • -d sends the specified data in an HTTPS request. In curl commands, use %2F to represent a backslash (/); for example, enter ethernet1/2/3 as ethernet1%2F1%2F3. For more information, see the curl Man page. View XML structure of CLI commands To use the RESTCONF API to configure and monitor an OS10 switch, create an HTTPS request with data parameters in JSON format. The JSON data parameters correspond to the same parameters in the XML structure of an OS10 command. To display the parameter values in the XML code of an OS10 command as reference, enter the debug cli netconf command in EXEC mode. In CONFIGURATION mode, enter the do debug cli netconf command. This command enables a CLI-to-XML display. At the prompt, enter the OS10 command for which you want to display the XML request and reply. To exit the CLI-to-XML display, enter the no debug cli netconf command. Locate the XML parameters values for the same JSON data arguments. For example, to configure VLAN 20 on an OS10 switch, you would enter the RESTCONF endpoint and JSON contents in the curl command. Note how the JSON type and name parameters are displayed in the XML structure of the interface vlan command. • RESTCONF endpoint: /restconf/data/interfaces • JSON data content: { "interface": [{ "type": "iana-if-type:l2vlan", "enabled": true, "description": "vlan20", "name": "vlan20" }] } • curl command: curl -X POST -u admin:admin -k "https://10.11.86.113/restconf/data/interfaces" -H "accept: application/json" -H "Content-Type: application/json" -d '{ "interface": [{ "type": "iana-if-type:l2vlan", "enabled": true, "description":"vlan20", "name":"vlan20"}]}' 788 RESTCONF API