Advent 2022: 11. A Simple Introduction to Beeminder's API

Ooh, this is very useful, and a brilliant way to do some simple scripts!

Since these curl commands can get very long, it might be worth checking out your operating system’s way of splitting commands across multiple lines.

At the standard Windows command prompt, I think it’s the ^ (caret) symbol. So you could type the example split across multiple lines as:

curl.exe -X POST ^
https://www.beeminder.com/api/v1/users/me/goals/aerobic/datapoints.json ^
-d auth_token="AbC12-abcd1234efgHIJ" ^
-d value="2.5" ^
-d comment="running on treadmill" 

Note that when you put the ^ at the end of the line, Windows prompts you with a “More?” at the start of the next line, just to remind you this is a multiline command. It therefore ends up looking like this in the command window:

C:\Users\clive>curl.exe -X POST ^
More? https://www.beeminder.com/api/v1/users/me/goals/aerobic/datapoints.json ^
More? -d auth_token="AbC12-abcd1234efgHIJ" ^
More? -d value="2.5" ^
More? -d comment="running on treadmill"

If you’re using Powershell in Windows, rather than the usual command prompt, I think the equivalent is the ` (backquote) character.

On Linux it’s \ (backslash) - probably the same for MacOS, too, but you’ll know that if you’re a Mac person I’m sure.

3 Likes