I've been trying to plug into the Toggl API for a project, and their examples are all using CURL. I'm trying to use the C# wrapper which causes a bad request when trying to create a report, so I thought I'd use Postman to try a simple HTTP request.
I can't seem to get the HTTP request to accept my API Token though. Here's the example that they give (CURL):
curl -u my-secret-toggl-api-token:api_token -X GET "https://www.toggl.com/reports/api/v2/project/?page=1&[email protected]&workspace_id=1&project_id=2"
I've tried the following HTTP request with Postman with a header called api_token with my token as the value:
https://www.toggl.com/reports/api/v2/project/[email protected]&project_id=9001&workspace_id=9001
(changed ids and email of course).
Any help on how to use the CURL -u in HTTP would be appreciated, thanks.
The client, curl, sends an HTTP request. The request contains a method (like GET, POST, HEAD etc), a number of request headers and sometimes a request body. The HTTP server responds with a status line (indicating if things went well), response headers and most often also a response body.
Postman, HTTPie, Flurl, FileZilla, and WinSCP are the most popular alternatives and competitors to cURL.
curl knows the HTTP method If you just pass in a HTTP URL like curl http://example.com , curl will use GET. If you use -d or -F curl will use POST, -I will cause a HEAD and -T will make it a PUT.
'cURL' is a command-line tool that lets you transmit HTTP requests and receive responses from the command line or a shell script. It is available for Linux distributions, Mac OS X, and Windows. To use cURL to run your REST web API call, use the cURL command syntax to construct the command.
The easy way is adding credential into url as user:pass@
format.
https://my-secret-toggl-api-token:[email protected]/reports/api/v2/project/?page=...
<---------------------------------->
Alternately you can use credential with your http header like below:
Authorization: Basic XXXXXX
Here XXXXXX
is base64(my-secret-toggl-api-token:api_token)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With