我们正在通过 magritte-rest-v2
设置休息集成。
文档涵盖了身份验证和进行休息调用,但没有完整的示例配置,我似乎无法让它工作。
有人有可以分享的工作配置以供引用吗?我的用例非常简单: token 身份验证和返回对象的分页列表。
最佳答案
以下是使用 oauth2 调用来检索 access_token 的源示例,然后将其放入 header 中:
type: magritte-rest-v2
sourceMap:
auth_source:
type: magritte-rest
url: 'https://auth.api.com/'
timeoutInMinutes: 3
proxy: 'http://proxy.com'
data_source:
type: magritte-rest-auth-call-source
proxy: 'http://main.api.com/'
url: 'http://proxy.com'
headers:
Authorization: 'Bearer {%token%}'
Accept: application/json
authCalls:
- source: auth_source
type: magritte-rest-call
method: POST
path: connect/token
headers:
Authorization: 'Basic {{basic_auth_secret}}'
formBody:
username: '{{username}}'
password: '{{password}}'
grant_type: password
scope: customer-api
extractor:
- type: magritte-rest-json-extractor
assign:
token: /access_token
关于palantir-foundry - Magritte REST 配置的完整示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70298172/