Struggling with v4 API

Hello All.

I can’t seem to get API calls working correctly. I’ve tried with curl and postman with no success. I have created a Personal Token that I use with Admin access. On straight GET requests, API seem to work. But with anything that requires a payload to be posted, everything fails. Below is one example trying to get users by username API service…

tman@redacted-desktop:~$ curl -i -d ["some-user"] -H 'Authorization: Bearer redacted token' https://redacted-url.com/api/v4/users/usernames
HTTP/1.1 400 Bad Request
Date: Thu, 09 Dec 2021 22:44:46 GMT
Server: Apache/2.4.41 (Ubuntu)
Content-Type: application/json
Vary: Accept-Encoding
X-Request-Id: ajcanpcgs38w7fku6rs9mhxepw
X-Version-Id: 6.1.0.6.1.0.ce1e55d3fdc3a6f6fe2070b3031f6272.false
Content-Length: 187
Connection: close

{"id":"api.context.invalid_body_param.app_error","message":"Invalid or missing usernames in request body.","detailed_error":"","request_id":"ajcanpcgs38wtman@redacted-desktop:~$

Any examples or help would be appreciated. Thanks!

So it seems I was using a different document. Googling let me to the v4 API documents with examples along with API service explanation. However using the example and copy/pasting and replacing relevant parts yielded the same results.

curl --location --request POST 'https://redacted-url.com/api/v4/users/usernames' \
--header 'Authorization: Bearer redacted-token' \
--header 'Content-Type: application/json' \
--data-raw 'someuser'

The above is the example given for the v4 API. Still getting same error.

Got it working with Postman. Thanks!