REST API调用keystone

一 调试工具
Curl
Firefox plugin
restclient-ui-3.4-jar-with-dependencies.jar

二 清空防火墙规则然后telnet
[root@controller0 ~]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
[root@controller0 ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
[root@controller0 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
telnet 10.20.0.10 5000

三 API查询地址
https://developer.openstack.org/api-ref/identity/v3/

四 运行restclient-ui-3.4-jar-with-dependencies.jar工具
1 配置HTTP请求和POST
REST API调用keystone_第1张图片
2 配置Body
REST API调用keystone_第2张图片
3 在body中填写请求内容,请提交请求
{
    "auth":{
            "tenantName":"admin",
            "passwordCredentials":{
                "username":"admin",
                "password":"admin"  
            }
        }
}
REST API调用keystone_第3张图片
返回内容如下:
{
  "access" : {
    "token" : {
      "issued_at" : "2018-02-24T13:13:25.479912",
      "expires" : "2018-02-24T14:13:25Z",
      "id" : "MIIEtQYJKoZIhvcNAQcCoIIEpjCCBKICAQExCTAHBgUrDgMCGjCCAwsGCSqGSIb3DQEHAaCCAvwEggL4eyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxOC0wMi0yNFQxMzoxMzoyNS40Nzk5MTIiLCAiZXhwaXJlcyI6ICIyMDE4LTAyLTI0VDE0OjEzOjI1WiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImRlc2NyaXB0aW9uIjogIkFkbWluIFRlbmFudCIsICJlbmFibGVkIjogdHJ1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fVI6ylcZ44IfqYCpwCZKqof3K8cWW8zGMCPZq-Rk21F47rVvhb5bE1cuXYoYQXA1DiBDMRFQfEcQnV5C0uy5cVRxymlMaBH1o+1Di1hG+jDkk3pRUmHHM4C2eUbf-+C7+k2E+2SCjCAD5TBQP7LyFFOEvsmhK5rrLILNmdabOJvKY-nVhJIJOqWIB0F6MEz19ysVxJ1cdMa9bCMAJQabHZe1kZQyOb",
      "tenant" : {
        "description" : "Admin Tenant",
        "enabled" : true,
        "id" : "4e845b494bf74cbf89213bf552db8599",
        "name" : "admin"
      }
    },
    "serviceCatalog" : [ {
      "endpoints" : [ {
        "adminURL" : "http://controller0:35357/v2.0";,
        "region" : "regionOne",
        "internalURL" : "http://controller0:5000/v2.0";,
        "id" : "4578c1e95d7b4ae7a6854924d0546e01",
        "publicURL" : "http://controller0:5000/v2.0";
      } ],
      "endpoints_links" : [ ],
      "type" : "identity",
      "name" : "keystone"
    } ],
    "user" : {
      "username" : "admin",
      "roles_links" : [ ],
      "id" : "6efb8d6615b84cacb7cbdf0591a66bb7",
      "roles" : [ {
        "name" : "admin"
      } ],
      "name" : "admin"
    },
    "metadata" : {
      "is_admin" : 0,
      "roles" : [ "56136419bd604aed82fbda5737e3af69" ]
    }
  }
}


你可能感兴趣的:(Openstack)