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 Filescurl-7.69.1-win64-mingwin"

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"

原文地址:https://www.cnblogs.com/liujx2019/p/13559147.html