Skip to main content

Documentation example

Feat API​

Feat API is a CRUD (Create, Retrieve, Update, Delete) API that enables a community to manage TRPG (Tabletop Role-Playing Game) feats in an online database.

πŸ“Œ Tip: Feats are abilities players can select to enhance their characters in numerous TRPGs, such as Pathfinder, Dungeons & Dragons, or Starfinder.

You can either use cURL commands or the Swagger UI to manage feats with the Feat API. Some commands require a valid API Key to authenticate requests, which you can generate using Discord.

Base URL
https://feat-api.onrender.com/

Generating API Keys​

Creating, updating, and deleting feats requires a valid API Key!

To generate an API Key:

  1. Log in to your Discord account, and open the #general channel of the Technical Writer's Weekly Discord group.

πŸ“Œ Tip: If you are not a member of the Technical Writer's Weekly Discord group, or you don't have a Discord account, you can follow this link to sign up!

  1. Enter !createApiKey in the #general channel.

WIP

  1. Check your direct messages. A Discord bot called "featAPIKey" should have sent you your API Key.

That's it! You can add your API Key to your HTTP header to authenticate your requests.

Feats​

You can manage the feats of the Feat API database using cURL commands or the Swagger UI.

Listing feats​

To list all feats in the Feat API database:

  1. Open the terminal or a CLI app of your choosing.
  2. Enter the following cURL command:
    curl -X GET "https://feat-api.onrender.com/feats/get" -H "accept: application/json"

Retrieving a feat by ID​

To retrieve a feat by filtering on its ID:

  1. Open the terminal or a CLI app of your choosing.
  2. Enter the following cURL command replacing FEAT-ID with the ID of the feat you are trying to find:
    curl -X GET "https://feat-api.onrender.com/feats/get/FEAT-ID" -H "accept: application/json"

Retrieving a feat by name​

To retrieve a feat by filtering on its name:

  1. Open the terminal or a CLI app of your choosing.
  2. Enter the following cURL command replacing FEAT-NAME with the name of the feat you are trying to find:
    curl -X GET "https://feat-api.onrender.com/feats/get/find/FEAT-NAME" -H "accept: application/json"

    πŸ“Œ Tip: Make sure to replace "spaces" with %20, "(" with %28, and ")" with %29.

    For example, you can filter on the feat called: "Awesome Blow (Monster)" by entering curl -X GET "https://feat-api.onrender.com/feats/get/find/Awesome%20Blow%20%28Monster%29" -H "accept: application/json"

Creating a feat​

ℹ️ Note: You must have a valid API Key to create feats. For more information on how to generate one, check out Generating API Keys! To create a new feat:

  1. Open the terminal or a CLI app of your choosing.
  2. Call the POST method of the feats/create endpoint and set the following parameters in the request body:
    • "name": "string"
    • "flavortext": "string"
    • "prereq": "string"
    • "benefit": "string"
    • "source": "string"

    πŸ“Œ Tip: You will see a message pop up in the #general channel of the Technical Writer's Weekly Discord group that your feat has been created.

    createFeatSuccess

    πŸ“ Example: If you would like to add a feat called "Arcane Blast", it would look like this, simply replace `API-KEY` with your API Key:

    curl -X POST "https://feat-api.onrender.com/feats/create" -H "accept: */*" -H "Authorization: API-KEY" -H "Content-Type: application/json" -d "{\"name\":\"Arcane Blast\",\"flavortext\":\"You can convert any spell into an attack.\",\"prereq\":\"Arcane spellcaster, caster level 10th.\",\"benefit\":\"As a standard action, you can sacrifice a prepared spell or unused spell slot of 1st level or higher and transform it into a ray, targeting any foe within 30 feet as a ranged touch attack. This attack deals 2d6 points of damage plus an additional 1d6 points of damage for every level of the spell or spell slot you sacrificed. 0-level spells may not be sacrificed in this manner.\",\"source\":\"Pathfinder Advanced Player’s Guide\"}"

Updating a feat​

ℹ️ Note: You must have a valid API Key to update feats. For more information on how to generate one, check out Generating API Keys!

To update a feat:

  1. Open the terminal or a CLI app of your choosing.
  2. Call the PATCH method of the feats/update/{_id} endpoint replacing the _id with the ID of the feat you are trying to update.
  3. πŸ“Œ Tip: The PATCH method changes all parameters! If you don't want to update a parameter, make sure to add the original value to the request body; otherwise, it will be updated as well.
  4. Add your API Key to the header.
  5. Set the following parameters in the request body:
    • "name": "string"
    • "flavortext": "string"
    • "prereq": "string"
    • "benefit": "string"
    • "source": "string"
  6. πŸ“ Example: If you would like to change the name of the feat called "Alertness" to "Awareness", it would look like this, simply replace `API-KEY` with your API Key:

    curl -X PATCH "https://feat-api.onrender.com/feats/update/FEAT-ID" -H "accept: */*" -H "Authorization: API-KEY" -H "Content-Type: application/json" -d "{\"name\":\"Awareness\",\"flavortext\":\"You often notice things that others might miss.\",\"prereq\":\"N/A\",\"benefit\":\"You get a +2 bonus on Perception and Sense Motive skill checks. If you have 10 or more ranks in one of these skills, the bonus increases to +4 for that skill.\",\"source\":\"Pathfinder RPG Core Rulebook\"}"

    Even though the only thing being changed is the feat's name, the other parameters must also be defined.

Deleting a feat​

ℹ️ Note: You must have a valid API Key to delete feats. For more information on how to generate one, check out Generating API Keys!

To delete a feat:

  1. Open the terminal or a CLI app of your choosing.
  2. ⚠️ Warning: Deleting a feat is permanent!
  3. Enter the following cURL command replacing FEAT-ID with the ID of the feat you are trying to delete and the API-KEY with your API Key:
    curl -X DELETE "https://feat-api.onrender.com/feats/FEAT-ID" -H "accept: */*" -H "Authorization: API-KEY"