Create issue API endpoint responds with invalid URL #1421

Closed
opened 2025-11-02 04:00:15 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @witten on GitHub (Jan 5, 2018).

[Macaron] 2018-01-05 04:31:49: Started POST /api/v1/repos/myuser/myproject/issues for 76.121.104.139
[Macaron] 2018-01-05 04:31:49: Completed POST /api/v1/repos/myuser/myproject/issues 201 Created in 74.513327ms

Description

When I create an issue via the API, I get back a response that includes an issue URL that 404s:

$ curl --request POST https://example.org/api/v1/repos/myuser/myproject/issues --user myuser:password --header "Accept: application/json" --header "Content-Type: application/json" --data '{ "body": "Test", "closed": false, "title": "Test" }' 
{"id":64,"url":"https://example.org/api/v1/repos/myuser/myproject/issues/64","number":48,"user":{"id":6,"login":"myuser","full_name":"","email":"myuser@noreply.example.org","avatar_url":"https://example.org/avatars/6","username":"myuser"},"title":"Test","body":"Test","labels":[],"milestone":null,"assignee":null,"state":"open","comments":0,"created_at":"2018-01-05T04:24:23Z","updated_at":"2018-01-05T04:24:23Z","pull_request":null}

Expected response: A working issue URL for the newly created issue.

It appears that the problem is that the "id" value is being substituted into the URL instead of the "number" field. If instead I go to the URL corresponding to the number value, https://example.org/api/v1/repos/myuser/myproject/issues/48, then it loads the newly created issue properly.

Originally created by @witten on GitHub (Jan 5, 2018). - Gitea version (or commit ref): 2f8c65c from https://hub.docker.com/r/gitea/gitea/ - Git version: 2.15.0 - Operating system: Debian GNU/Linux 9 (stretch) + Docker 17.12.0-ce - Database: - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes - [x] No (create account is 500ing) - [ ] Not relevant - Logs: ``` [Macaron] 2018-01-05 04:31:49: Started POST /api/v1/repos/myuser/myproject/issues for 76.121.104.139 [Macaron] 2018-01-05 04:31:49: Completed POST /api/v1/repos/myuser/myproject/issues 201 Created in 74.513327ms ``` ## Description When I create an issue via the API, I get back a response that includes an issue URL that 404s: ``` $ curl --request POST https://example.org/api/v1/repos/myuser/myproject/issues --user myuser:password --header "Accept: application/json" --header "Content-Type: application/json" --data '{ "body": "Test", "closed": false, "title": "Test" }' {"id":64,"url":"https://example.org/api/v1/repos/myuser/myproject/issues/64","number":48,"user":{"id":6,"login":"myuser","full_name":"","email":"myuser@noreply.example.org","avatar_url":"https://example.org/avatars/6","username":"myuser"},"title":"Test","body":"Test","labels":[],"milestone":null,"assignee":null,"state":"open","comments":0,"created_at":"2018-01-05T04:24:23Z","updated_at":"2018-01-05T04:24:23Z","pull_request":null} ``` Expected response: A working issue URL for the newly created issue. It appears that the problem is that the "id" value is being substituted into the URL instead of the "number" field. If instead I go to the URL corresponding to the number value, `https://example.org/api/v1/repos/myuser/myproject/issues/48`, then it loads the newly created issue properly.
GiteaMirror added the issue/duplicate label 2025-11-02 04:00:15 -06:00
Author
Owner

@lunny commented on GitHub (Jan 5, 2018):

duplicated with #3297 and resolved by #3298

@lunny commented on GitHub (Jan 5, 2018): duplicated with #3297 and resolved by #3298
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1421