401 error for POST request using the API in make.com

[ad_1]

I am trying to create a new course using an API Post request in make.com. I get a 401 error saying that this user is not permitted to create courses.

Strangely, I can GET course info using the API (same credentials / header info as when using the POST request)

The API-key I use has “read_write” permissions.

What could be the issue here?

This is the input in the make.com module “make an API key auth request” module

[
{
"ca": null,
"qs": [],
"url": "https://kurse.adlx.de/wp-json/llms/v1/courses",
"data": "{\"title\":\"My course title\",\"content\":\"My course content\"}",
"gzip": true,
"method": "post",
"headers": [
{
"name": "consumerKey",
"value": "ck_xxxxxxxxxmyConsumerKey"
},
{
"name": "consumerSecret",
"value": "cs_xxxxxxxxxmySecretKEy"
}
],
"timeout": null,
"useMtls": false,
"bodyType": "raw",
"contentType": "application/json",
"serializeUrl": false,
"shareCookies": false,
"parseResponse": true,
"followRedirect": true,
"useQuerystring": false,
"followAllRedirects": false,
"rejectUnauthorized": true
}
]

This is the output

[
{
"statusCode": 401,
"headers": [
{
"name": "server",
"value": "nginx"
},
{
"name": "date",
"value": "Fri, 18 Oct 2024 19:22:07 GMT"
},
{
"name": "content-type",
"value": "application/json; charset=UTF-8"
},
{
"name": "transfer-encoding",
"value": "chunked"
},
{
"name": "connection",
"value": "keep-alive"
},
{
"name": "x-powered-by",
"value": "PHP/7.4.33"
},
{
"name": "x-robots-tag",
"value": "noindex"
},
{
"name": "link",
"value": "<https://kurse.adlx.de/wp-json/>; rel=\"https://api.w.org/\""
},
{
"name": "x-content-type-options",
"value": "nosniff"
},
{
"name": "access-control-expose-headers",
"value": "X-WP-Total, X-WP-TotalPages, Link"
},
{
"name": "access-control-allow-headers",
"value": "Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type"
},
{
"name": "allow",
"value": "GET"
},
{
"name": "set-cookie",
"value": "wp_llms_session_xxxxCookieKeyxxxx; expires=Sat, 19-Oct-2024 01:22:07 GMT; Max-Age=21600; path=/; secure; HttpOnly"
}
],
"cookieHeaders": [
"wp_llms_session_xxxxCookieKeyxxx; expires=Sat, 19-Oct-2024 01:22:07 GMT; Max-Age=21600; path=/; secure; HttpOnly"
],
"data": {
"code": "llms_rest_unauthorized_request",
"message": "Du bist mit diesem Benutzer leider nicht berechtigt, Kurse zu erstellen.",
"data": {
"status": 401
}
},
"fileSize": 148
}
]

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer