Windows cURL 获取 Openstack Swift Token

1. Download CURL for Windows from https://curl.haxx.se/windows/ 

2. Extract it to a place, such as "C:\Program Files\".

3. Open CMD and cd to "C:\Program Files\curl-7.69.1-win64-mingw\bin"

4. Run "curl xxx" same as in Linux.



Notice the differences from using in Linux:

1. The \ which indicating a same line doesn't apply anymore.

2. All the ' should be replaced with ".

3. All the data part (after -d, and inside ""), should replace " with \".

 

For example:

In Linux, the comand looks like:

curl -i \
  -H "Content-Type: application/json" \
  -d '
{ "auth": {
    "identity": {
      "methods": ["password"],
      "password": {
        "user": {
          "name": "user",
          "domain": { "id": "default" },
          "password": "root"
        }
      }
    },
    "scope": {
      "project": {
        "name": "admin",
        "domain": { "id": "default" }
      }
    }
  }
}' -k \
  "https://1.1.1.10:5000/v3/auth/tokens"



In Windows, it should be transferred to 

curl -i   -H "Content-Type: application/json" -d "{\"auth\":{\"identity\":{\"methods\":[\"password\"],\"password\":{\"user\": {\"name\": \"user\",\"domain\":{\"id\":\"default\"},\"password\":\"root\"}}},\"scope\":{\"project\":{\"name\": \"admin\",\"domain\":{\"id\": \"default\" }}}}}" -k "https://1.1.1.10:5000/v3/auth/tokens"

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...