discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

correct interaction creation success response code

Open buckley-w-david opened this issue 1 year ago • 3 comments

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}

buckley-w-david avatar Jul 19 '22 05:07 buckley-w-david

If the command already exists it returns 200, otherwise it returns 201.

devsnek avatar Jul 19 '22 06:07 devsnek

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?

buckley-w-david avatar Jul 19 '22 06:07 buckley-w-david

This would be a good place to add it :)

typpo avatar Jul 21 '22 16:07 typpo