[ChatGPT] 10 steps Let ChatGPT and Plugins help you to write APIs document

MorriLiu
3 min readJun 21, 2023

--

How to use ChatGPT help you to write APIs document?

Why would doing this?

  • Back-end have a lot of communication way to talk about API with Front-end
  • Why not use the uniform format and let chatGPT doing this and make document easier and spend less time

🙌 Let’s start🙌

  1. We need to focus on which api need to write, so have to find the whole relevant file, In this example I have 11 file (Rails)
  2. Make a file, use copy paste to a “Pages” or “Microsoft Word” like below. Make sure have title, like File 1 or Response File or Error code File etc…

3. Save as a PDF file

4. Go to your ChatGPT Plus setting and open the Plugins

5. Install AskYourPDF

6. Go to this official website https://askyourpdf.com/upload , and upload your pdf file in step 3

7. After upload success , you will get a doc-id and copy it

8. Now, back to your chatGPT4 use this Prompt, and Remember change doc_id that you copied and Change what api endpoint you want make it write !!!

You are a technical writer and rails expert, I am sending to you links to API documentation. I would like that you create API specs for the pdf file I share with you :

What is this document about? doc_id: xxxxxxx

Write the api endpoint for "GET /xxx/xd/c/:id/xabvdx/t133ons/impffffrts"
You need specifically to take into account the following principles when you write the API specs. Please, include all endpoints shared.

You need to have operation id defined.
Add the Payload to api document
Add the Response to api document
Add description to parameters
Use correct grammar and ends the plugin description with punctuation
Limited number of endpoints per API specs
Examples should be provided for responses
Provides informative error messages. Guide a user of the plugin about what they can do and the available endpoint for the API otherwise so they are not blocked. This is especially true for errors of not found or request that are not reflecting how the API is being used.”
Additional use of table format for error code , http status code, error description writing

9. If it’s work, it will look like this

10. Error table like below

Summary and How to improve

  1. If we can change title of the pdf file, not just use File 1,2,3…., And use Response File, Error Code File be a title, ChatGPT will give you a better error table and response about api
  2. If we want to write api documents by ChatGPT and Plugin will work, just need a little bit change about the pdf file and it’s title

--

--