using curl to debug rest call
来源:互联网 发布:reveal for mac破解版 编辑:程序博客网 时间:2024/06/14 09:15
郁闷,之前写的一篇curl的文章怎么莫名其妙的没有了,简略记录一下:
第一步:拿到token
curl -d '{"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "xxx"}}}' -H "Content-type: application/json" http://xxx:5000/v2.0/tokens | python -m json.tool
"token": {
"audit_ids": [
"Gpwcp3fkTlO0WMKmor9wmQ"
],
"expires": "2015-03-20T01:23:38Z",
"id": "fc1b2493ba314c29a3c8f71a3eca665a",
"issued_at": "2015-03-20T00:23:38.989053",
"tenant": {
"description": "admin tenant",
"enabled": true,
"id": "d63f0cca2367489780c2e29e1034c02b",
"name": "admin"
}
},
第二步,根据token去call rest api:
curl -H "X-Auth-Token:fc1b2493ba314c29a3c8f71a3eca665a" http://xxx:6385/v1/ports/9f10c0b8-4400-4e04-8db0-e42c7f689425 | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 423 100 423 0 0 5134 0 --:--:-- --:--:-- --:--:-- 5158
{
"address": "xxxx",
"created_at": "2015-03-19T04:46:03+00:00",
"extra": {},
"links": [
{
"href": "http://xxxx:6385/v1/ports/9f10c0b8-4400-4e04-8db0-e42c7f689425",
"rel": "self"
},
{
"href": "http://xxxx:6385/ports/9f10c0b8-4400-4e04-8db0-e42c7f689425",
"rel": "bookmark"
}
],
"node_uuid": "8cdc7750-9d66-4353-ab3e-99fe82e739e2",
"updated_at": null,
"uuid": "9f10c0b8-4400-4e04-8db0-e42c7f689425"
}
curl的命令使用http://www.cnblogs.com/gbyukg/p/3326825.html 讲解还不错,基本用法都有了
- using curl to debug rest call
- using curl to debug ironic(2)
- Alternative to file_get_contents() using cUrl
- RESTeasy to make a REST Call
- Using Advanced REST Client to test REST Request.
- Using cURL to automate HTTP jobs
- Using cURL to automate HTTP jobs
- REST CURL
- Using WinInet to call a Web service
- Using JDB to debug Java Program
- Using Aptana To Edit/Debug Javascript
- Using Valgrind to debug memory leaks
- using gdb to debug c program
- How to Debug issue’s Related to VoIP Call
- Using cURL to get login to yahoo.com by Porosh
- Using CURL to exploit LFI to RCE from command line
- php curl Call to undefined function curl_init()问题
- php使用curl函数提示Call to undefined function curl_init()
- 微博CacheService架构浅析
- (素材源码) 猫猫学IOS(五)UI之360等下载管理器九宫格UI
- 黑马程序员——ARC与autorelease
- 【 D3.js 高级系列 — 2.0 】 捆图
- 有序和无序
- using curl to debug rest call
- Firefox、Thunderbird附件组件ReminderFox事件时间不能修改如何处理?
- POJ1003--Hangover 翻译
- Cocos2dx使用 TexturePacker导出的.plist
- NFC
- 三角形类1
- 三角形类2
- mysql order by优化
- linux上ln命令