【问题标题】:How to access Gravitee AM api如何访问 Gravitee AM api
【发布时间】:2021-03-25 21:35:32
【问题描述】:

如何 curl 基本的 gravitee am api?我试过简单的也不行?

curl -X POST http://localhost:8093/admin/token -H 'authorization: Basic base64(admin:adminadmin)'

curl -X POST http://localhost:8093/admin/token -H 'Authorization: Basic YWRtaW46YWRtaW5hZG1pbg=='

它说 404 未找到。结果如下:

*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8093 (#0)
> POST /admin/token HTTP/1.1
> Host: localhost:8093
> User-Agent: curl/7.58.0
> Accept: */*
> Authorization: Basic YWRtaW46YWRtaW5hZG1pbg==
> 
< HTTP/1.1 404 Not Found
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Type: text/html;charset=iso-8859-1
< Content-Length: 0
< 
* Connection #0 to host localhost left intact

【问题讨论】:

    标签: api-gateway gravitee


    【解决方案1】:

    首先你必须请求一个访问令牌:

    curl -X POST http://localhost:8093/management/auth/token -u admin:adminadmin
    

    您应该会收到此有效负载:

    {"access_token":"eyJraWQiOiJkZWZ......TyJ37E","expires_at":"Mon Nov 29 15:06:12 CET 2021","token_type":"bearer"}
    

    那么你就可以使用这个access_token来请求访问管理API了。

    curl -X GET http://localhost:8093/management/organizations/DEFAULT/environments/DEFAULT/domains/ -H'Authorization: Bearer eyJraWQiOiJkZWZ......TyJ37E'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-20
      • 1970-01-01
      • 2013-06-12
      • 2014-03-12
      • 2013-03-24
      • 2015-09-05
      • 2018-06-11
      • 2016-02-10
      相关资源
      最近更新 更多