API authentication not working when used in CURL command on Windows

book

Article ID: 206422

calendar_today

Updated On:

Products

BlazeMeter

Issue/Introduction

API keys not working getting un-authorized. I tried generating new keys and still the same issue.

 

https://bzm.cluster01.cic-vbbbl-abc.net/api/v4/user --user '<Api KEYS>'
{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    },
    "api_version": 4,
    "result": null,
    "request_id": "5ff6362149613"
}

 

Cause

When running CURL in Windows environment you would have to provide <API key>  in double quotes " "  instead of ' ' . 

Environment

Release : SAAS

Component : BLOCKMASTER

Resolution

when using CURL command in Windows environment you would have to provide  " "  instead of ' '  for <API key>.  Once we made the change  it worked 

Here is the sample

curl -X GET https://a.blazemeter.com/api/v4/schedules?testId=570005 -H "Content-Type: application/json" --user "4334dc6cddddddddd:48808bbfsdfsdgsdfsdfsdfsdfsdfffffff23448160a3a398e9a833695c55bd"

 

Example of API call to start a test using CURL in windows


curl https://a.blazemeter.com/api/v4/tests/1234567/start?delayedStart=false \
    -X POST \
    -H 'Content-Type: application/json' \
    --user "api_key_id:api_key_secret"