mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-04 04:59:40 +00:00
HabitRPG -> Habitica
This commit is contained in:
parent
4f333c4f8a
commit
64a3009e7a
1 changed files with 6 additions and 6 deletions
|
|
@ -63,7 +63,7 @@ html
|
|||
body.swagger-section
|
||||
#header
|
||||
.swagger-ui-wrap
|
||||
a#logo(href='http://swagger.wordnik.com') HabitRPG API Documentation
|
||||
a#logo(href='http://swagger.wordnik.com') Habitica API Documentation
|
||||
|
||||
.swagger-ui-wrap(style='padding:50px')
|
||||
form#api_selector
|
||||
|
|
@ -76,11 +76,11 @@ html
|
|||
a#explore(href='#') Explore
|
||||
br
|
||||
h2 Two API Types
|
||||
p HabitRPG's API is meant for two different audiences: (1) extensions and scripts, and (2) full-fledged applications. Extensions and scripts can utilize Habit's up/down scoring for individual tasks. An example of this in action is the <a href="https://chrome.google.com/webstore/detail/habitrpg/pidkmpibnnnhneohdgjclfdjpijggmjj?hl=en-US">Chrome Extension</a>, which up-scores you for visiting productive websites, and down-scores you for visiting procrastination websites. Other examples currently in use are Pomodoro, Anki, and Github scripts - which up-score you for good behavior and downscore you for bad behavior - <a href="http://habitrpg.wikia.com/wiki/App_and_Extension_Integrations">see the list</a>. The second API consumer is for full-fledge applications, which need read / write access to the entire user document. An example of this would be Mobile Apps or Desktop application.
|
||||
p Habitica's API is meant for two different audiences: (1) extensions and scripts, and (2) full-fledged applications. Extensions and scripts can utilize Habitica's up/down scoring for individual tasks. An example of this in action is the <a href="https://chrome.google.com/webstore/detail/habitrpg/pidkmpibnnnhneohdgjclfdjpijggmjj?hl=en-US">Chrome Extension</a>, which up-scores you for visiting productive websites, and down-scores you for visiting procrastination websites. Other examples currently in use are Pomodoro, Anki, and Github scripts - which up-score you for good behavior and downscore you for bad behavior - <a href="http://habitica.wikia.com/wiki/App_and_Extension_Integrations">see the list</a>. The second API consumer is for full-fledge applications, which need read / write access to the entire user document. An example of this would be Mobile Apps or Desktop application.
|
||||
h2 Extensions / Scripts
|
||||
p HabitRPG has a simple API for up-scoring and down-scoring third party Habits: <code>POST /api/v2/user/tasks/{id}/{direction}</code> (headers <code>x-api-user</code> and <code>x-api-key</code> required).
|
||||
p Habitica has a simple API for up-scoring and down-scoring third party Habits: <code>POST /api/v2/user/tasks/{id}/{direction}</code> (headers <code>x-api-user</code> and <code>x-api-key</code> required).
|
||||
h4 Example
|
||||
p <code>curl -X POST -H "x-api-key: YOUR_API_TOKEN" -H "x-api-user: YOUR_USER_ID" https://habitrpg.com/api/v2/user/tasks/productivity/up</code>
|
||||
p <code>curl -X POST -H "x-api-key: YOUR_API_TOKEN" -H "x-api-user: YOUR_USER_ID" https://habitica.com/api/v2/user/tasks/productivity/up</code>
|
||||
p Note: You may need to add <code>--compressed -H "Content-Type:application/json"</code> to your curl if you get errors.
|
||||
ul
|
||||
li POST to the URL <code>/api/v2/user/tasks/{id}/{direction}</code>
|
||||
|
|
@ -90,9 +90,9 @@ html
|
|||
li <code>apiToken</code> (POST body) <em>required</em>
|
||||
p A more advanced version that allows modification of other types of tasks is available in the /user/tasks/{id}/{direction} route in the full API below.
|
||||
h2 Full API
|
||||
p All API requests should be prefaced by <code>https://habitrpg.com</code>. Every authenticated request should include two headers. Your api key (<code>x-api-key</code>) and your user id (<code>x-api-user</code>). Do not include <code>{}</code> braces in your header (<code>-H 'x-api-user: a94b6d9d-6b64-43ae-856c-2c3f211bd426'</code>)
|
||||
p All API requests should be prefaced by <code>https://habitica.com</code>. Every authenticated request should include two headers. Your api key (<code>x-api-key</code>) and your user id (<code>x-api-user</code>). Do not include <code>{}</code> braces in your header (<code>-H 'x-api-user: a94b6d9d-6b64-43ae-856c-2c3f211bd426'</code>)
|
||||
h2 Requirements:
|
||||
p The base-url for all routes is /api/v2. So /user actions will be at https://habitrpg.com/api/v2/*. You need to send x-api-user and x-api-key headers for each request.
|
||||
p The base-url for all routes is /api/v2. So /user actions will be at https://habitica.com/api/v2/*. You need to send x-api-user and x-api-key headers for each request.
|
||||
p For create & edit paths (PUT & POST), you'll need to know the schema of the object you're trying to create or edit. See Schema <a href='https://github.com/HabitRPG/habitrpg/tree/develop/website/src/models' target="_blank">definitions here</a>
|
||||
p If any of the documentation is lacking or you're having trouble with it, please post an issue to <a href='https://github.com/HabitRPG/habitrpg/issues' target='_blank'>Github</a>
|
||||
#message-bar.swagger-ui-wrap
|
||||
|
|
|
|||
Loading…
Reference in a new issue