discord-api-docs
discord-api-docs copied to clipboard
correct interaction creation success response code
The docs say that successfully creating an interaction returns a 201 CREATED
response code. I have observed that this is not correct, and instead it returns a 200 OK
.
[I] david@darvid-pc ~/scripts [3]> curl -v -d '{"name": "slash-example", "type": 1, "description": "Example slash interaction", "options": []}' -H 'Content-Type: application/json' -H 'Authorization: Bearer {{TOKEN}}' 'https://discord.com/api/v10/applications/{{CLIENT_ID}}/commands'
* Trying 162.159.137.232:443...
* Connected to discord.com (162.159.137.232) port 443 (#0)
* ...
* We are completely uploaded and fine
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 200
< ...
* Connection #0 to host discord.com left intact
{"id": "...", "application_id": "...", "version": "...", "default_permission": true, "default_member_permissions": null, "type": 1, "name": "slash-example", "name_localizations": null, "description": "Example slash interaction", "description_localizations": null, "dm_permission": true}
If the command already exists it returns 200, otherwise it returns 201.
Ah, that would explain it. Is that documented somewhere I'm not seeing, or would it be useful to change this PR to adding that context?
This would be a good place to add it :)