我正在尝试弄清楚如何使用 Postman 和 POST 方法对名为 Ongage 的网站进行 API 调用。
基本上,这是一个 API 调用,将从 Ongage 发送事务消息。
在“POST /api/transactional”部分下,我必须使用以下内容:
POST URL: https://api.ongage.net/<list_id>/api/transactional
因此,在 Postman 中,我使用 POST 并使用提供的 list_id 输入上面的 URL,但我收到以下消息:
{
"metadata": {
"error": true
},
"payload": {
"code": 401,
"errors": [],
"message": "Invalid Credentials. Please provide valid x_username, x_password and x_account_code
headers. x_account_code as displayed in the \"Account Profile\" page in your Ongage account."
}
}
我之前使用 Postman 进行简单的 API 请求,但没有需要输入用户名和密码的地方。
我不知道该在哪里输入。
请帮忙,谢谢。
** 编辑 **
因此,我可以单击 Body,然后单击 raw,以便可以输入用户名、密码和 account_code 的 JSON 值,如下所示:
{
"username": "username1",
"password": "password2",
"account_code": "account_code3"
}
但我仍然收到与以前相同的消息,指出凭据无效。
凭证只是无效,还是我做错了?
常见问题解答中对此进行了介绍
https://ongage.atlassian.net/wiki/spaces/HELP/pages/70418454/API+FAQ
*2。这些是您需要在请求标头中发送的凭据:
X_USERNAME:您的_ongage_用户名
X_PASSWORD:您的_ongage_密码
X_ACCOUNT_CODE:您的_ongage_account_code*