Recipes and tools for debugging the API

AI-generated summary

The discussion revolves around debugging the Discourse API. maiki is trying to troubleshoot an issue and requests tools and recipes from the community to interact with the API.

Several users share their preferred tools for API debugging: itsbhanusharma and rorycb recommend using Postman, while rorycb also suggests Insomnia. maiki appreciates the suggestions, noting that they also use Insomnia.

Seluj78 provides a specific curl request generated from Postman to help maiki reproduce a 500 error issue with user creation when the username is an integer.

Heya folks!

I was looking at API 500 on user creation if username is integer and can only kinda reproduce it, using curl. I’m looking through the docs to see if there is a useful output to capture to assist in figuring out what is happening, and then remember httpie as well…

And then I thought I’d just ping the @support-explorers and ask if they would share tools and recipes they use to debug the API! :sunglasses:

What do you use to troubleshoot and interact with the API?

:computer: :spider_web: :mag:

In general, I am a huge fan of Postman. it helps to emulate API calls and their responses.

I generally use Insomnia or Postman for any API debugging (not just Discourse), I don’t really have any collections to share to speed that up for you though :smiley:

That’s great, that’s what I’m looking for. :slight_smile:

I also use insomnia to get through some wicked problems… :tired_face:

Oh, you meant https://insomnia.rest/! :slight_smile:

(TIL: there is a .rest TLD!)

Hi @maiki, thanks for looking into this!

Here’s a CURL request you can use, which was generated from postman (if you’d like). This generates a 500:

curl --location --request POST 'https://XXX.com/users.json' \
--header 'Api-Key: XXX' \
--header 'Api-Username: XXX' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "XXX",
    "email": "XXX@mail.com",
    "password": "aTestPAssword",
    "username": 1,
    "active": true,
    "approved": true
}'