API Guide

卷曲命令
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"}]}'
要显示卷曲命令中 type name 参数的值请显示 interface vlan 20 配置命令的 XML 结构
OS10(config)# do debug cli netconf
OS10(config)# interface vlan 10
Request:
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<candidate/>
</target>
<default-operation>merge</default-operation>
<error-option>stop-on-error</error-option>
<test-option>set</test-option>
<config>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type" xmlns:dell-if="http://
www.dellemc.com/networking/os10/dell-interface" xmlns:dell-eth="http://www.dellemc.com/
networking/os10/dell-ethernet" xmlns:dell-lag="http://www.dellemc.com/networking/os10/dell-
lag">
<interface>
<type>ianaift:l2vlan</type>
<name>vlan10</name>
</interface>
</interfaces>
</config>
</edit-config>
</rpc>
Reply:
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="10">
<ok/>
</rpc-reply>
OS10(config)# do no debug cli netconf
Identifier
GUID-73A62207-FBA1-44D8-8571-C17C451F1D7B
Version 3
Status Translation approved
RESTCONF API 示例
一些常见的 RESTCONF API 操作包括配置系统主机名称和环回接口等接口。本部分中的示例使用 curl 命令发送 HTTPS 请求。
Identifier
GUID-DF57FE51-7D79-4EAA-BA08-E9CCB33836A5
Version 1
Status Translation approved
系统
配置系统主机名称
RESTCONF
端点
/restconf/data/dell-system:system/hostname
JSON 内容
{
"hostname":"MyHost"
}
参数
hostname string 输入系统的主机名称。默认值为 OS10
RESTCONF API 1325