[Openstack] curl example for quantum api "create port"

gong yong sheng gongysh at linux.vnet.ibm.com
Fri May 24 11:30:53 UTC 2013


the fastest way to learn the API is to run quantum client with -v:
# quantum port-create --request-format xml net1 -v
.....
REQ: curl -i http://localhost:9696/v2.0/ports.xml -X POST -H 
"X-Auth-Token: 22ac5a38128949adaa852282a9ec8bd3" -H "Content-Type: 
application/xml" -H "Accept: application/xml" -H "User-Agent: 
python-quantumclient" -d '<?xml version="1.0" encoding="UTF-8"?>
<port xmlns="http://openstack.org/quantum/api/v2.0" 
xmlns:quantum="http://openstack.org/quantum/api/v2.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><network_id>671cc79b-5f53-4e68-ba35-7effbe015706</network_id><admin_state_up 
quantum:type="bool">True</admin_state_up></port>'

On 05/24/2013 06:47 PM, Thomas Kärgel wrote:
> Hi,
>
> i'm tryning to create a port in quantum via a curl:
>
> curl -H "X-Auth-Token: 978ed39cd13645c5a7024ad9d954c914" -d '<?xml
> version="1.0" encoding="UTF-8"?><port admin_state_up="true"
> device_id="d21f15c5-a7f0-47eb-854d-330e1227f572" name="test"
> network_id="9e770d5c-238a-4317-a129-9fd96dca8a6b"></port>' -H
> "Content-Type: application/xml; charset=UTF-8" -H "Accept:
> application/xml" http://quantumserver:9696/v2.0/ports.xml
>
> the answer i get from quantum is:
> <QuantumError>
> 	Unable to find 'port' in request body
> </QuantumError>
>
> What am i doing wrong? I think I'm not seeing the forest for the trees.
>
> Best regards
> Thomas
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack at lists.launchpad.net
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20130524/d715a346/attachment.html>


More information about the Openstack mailing list