I wanted to experiment with Make + Habitica with custom API calls that aren’t included in the main integration. I started by using code from their documentation and added header items for User ID/API Key (Key omitted from screenshot for privacy reasons) One time it returned a “404 error not found” but most of the time it returned the “unexpected token” error, with the token being t or some other letter.
I am looking for a solution that uses the “Make API Call” action from Habitica with as little coding as possible.
The body needs to be Json most likely. Have a look
Thanks for sharing this link, but I’m not sure if it helps. I already have Habitica’s API here:
Was there a different part of the forum thread that I needed to pay attention to?
In the doc they show what looks like Json for successful/failed results, but the command itself looks like a URL.
Can you link in the docs to your particular endpoint?
I am not entirely sure if this is the endpoint but the url I was using in my current experiment was
You also need to populate x-client-header
Comrades are Habiticans who create third-party tools. This includes but is not limited to: web-based tools, apps, browser extensions, any code that uses Habitica's API, and CSS templates. If you would like to create such tools, it is important to...
Here it is
The required Body Parameters need to be in a json structure in your request content. It’s a json string you need to build.
You must use
json or xml in the request content body always.
See their example
"text": "Update Habitica API Documentation - Tasks",
"notes": "Update the tasks api on GitHub",
"text": "read wiki",
"text": "write code"
I think I got it from an example on the wiki and thought it would work if I put everything in the right place.
curl -X POST -d "type=todo&text=New Task Text¬es=Some Notes" \
-H "x-api-user: 12345678-90ab-416b-cdef-1234567890ab" \
-H "x-api-key: 12345678-90ab-416b-cdef-1234567890ab" \
-H "x-client: 12345678-90ab-416b-cdef-1234567890ab-Testing" \
Application Programming Interface | Habitica Wiki | Fandom
Wait, the “successful response” is what I needed to look at for the json example?
A response is what the api call sends back. Request content is what you send in. Curl examples aren’t going to cut it. The -d option is a key value pair that is converted to json behind the scenes.
Here’s more on the topic of
json young padawan.
Just making sure I wasn’t misreading it. But if I want to use the API form in the Habitica module it would be something like this:
URL: (relative to habitica API url)
Then for the Headers, I would want to put all of the headers included in the guidance article (or the ones I need to actually Do The Thing)?
Yes that’s right. Their docs are a bit of Mess but look at the link I sent you and ignore their curl stuff.
Okay the example worked. It makes a little more sense now. I agree that their docs are hard to follow. I appreciate the help.
That’s good. Their docs are pretty much par for the course. If you really want to understand apis and practice how they work use postman and look for
postman collections. That will give you a very thorough understanding.