Contribution à la documentation de l'API Discourse

:bookmark: This is a guide for contributing to the official Discourse API documentation.

:person_raising_hand: Required user level: Developer

:gear: Console access required

Do you want to contribute to the official API documentation at https://docs.discourse.org? This guide will explain step by step how to do it.

Summary

This documentation will guide you through the following steps:

  • Setting up prerequisites.
  • Cloning the Discourse API documentation repository.
  • Editing the API documentation files.
  • Viewing your changes locally.
  • Creating a pull request.

Prerequisites

You must have a Discourse development installation. If you don’t have one, follow the guide that suits your environment in these topics.

Cloning the Discourse API docs repository

Assuming your Discourse development installation is inside your home directory ~/, proceed with the following steps to clone the repository:

  1. From your home directory, clone the repository at https://github.com/discourse/discourse_api_docs:

    git clone https://github.com/discourse/discourse_api_docs
    
  2. You should now have the discourse and discourse_api_docs folders side by side:

    ~/discourse/
    ~/discourse_api_docs/
    

Editing the API documentation files

You must edit the documentation directly from ~/discourse/spec/requests/api/.

After editing the documentation files, run the following command from ~/discourse/:

bin/rake rswag:specs:swaggerize && cp openapi/openapi.yaml ~/discourse_api_docs/openapi.yaml

The documentation will be generated using rswag and copied into ~/discourse_api_docs/.

Viewing your changes locally

To view your updated documentation, follow these steps:

  1. From ~/discourse_api_docs/, run:

    npm install
    node server.js
    
  2. Browse to http://localhost:3001 to see the updated documentation.

Creating a pull request

Once you verify that everything looks good, create a pull request from the discourse/discourse repository (not the Discourse API Docs repository).

Common issues and solutions

Reporting errors in Discourse API documentation

If you encounter issues or errors in the Discourse API documentation, please report them on the Discourse Meta forum - you can follow the bug report guide to help you do this effectively.

Additional resources

Last edited by @hugh 2024-06-11T05:08:16Z

Check documentPerform check on document:
15 « J'aime »

Comment signaler les erreurs dans la documentation de l’API Discourse
Le dépôt Github pour la documentation de l’API n’a pas d’onglet “problèmes” activé

Bonjour et bienvenue @srinivas.chilukuri :slight_smile:
Vous pouvez les signaler ici. :+1: Quel est le problème ?

2 « J'aime »

Référence : Documentation de l’API Discourse Obtenir un groupe

Actions : Groupes / Obtenir un groupe

  • Dans la documentation, le paramètre de chemin est indiqué comme id, mais lorsque l’on interroge, le chemin n’existe pas.
  • En rétro-ingénierie de la même requête via l’interface utilisateur de Discourse, le paramètre de chemin est le nom du groupe et cela fonctionne via la clé API.

2 « J'aime »

3 messages ont été déplacées vers un nouveau sujet : Document basic-info api endpoint