微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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"

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐