I am using java to make http call to circle ci REST API with access token
HttpGet request = new HttpGet(“https://circleci.com/api/v1.1/me?circle-token=:”);
I get msg at console {:message “You must log in first.”}. I didnt expect to see this becasue i am using my circle ci access token in URL for authentication.
Thanks
Amit
Hi Amit,
In the API call you’re making, you’re trying to get information about your current user. If you have created an API token on a project level, you will not be able to retrieve information about your CircleCI user with that API token.
For the above mentioned API call to work, you need to generate your API token over here: https://circleci.com/account/api
If what you want is to work with a specific project and if that’s where you generated the API token, try something like this and see if that works:
GET: https://circleci.com/api/v1.1/project/github/your_username/your_project
2 Likes
You can always test a token with cURL to rule out the token being the issue.
1 Like
Sorry to respond late. It has been working fine. I was including : in the key which was the whole issue. Thanks for the inputs.
1 Like