Cannot create pull request from V1 API #4995

Closed
opened 2025-11-02 06:10:26 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @unnikrishnan-anil on GitHub (Mar 3, 2020).

  • Gitea version (or commit ref): 1.9.3
  • Git version: 2.20.1
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

I have been trying to create a pull request through the V1 API. The POST request I send is as follows:

http://localhost:3000/api/v1/repos/anil/test/pulls?token=

Body:

{
"assignee": "anil",
"base": "master",
"head": "branch2",
"title": "Testing PR"
}

I get the following response:

422 Unprocessable Entity

[
{
"fieldNames": [
"Head"
],
"classification": "RequiredError",
"message": "Required"
},
{
"fieldNames": [
"Base"
],
"classification": "RequiredError",
"message": "Required"
},
{
"fieldNames": [
"Title"
],
"classification": "RequiredError",
"message": "Required"
}
]

I tried using a git repo (https://github.com/dblueai/giteapy) and I get the same response. Has something changed or am I not passing the parameters the right way?

Originally created by @unnikrishnan-anil on GitHub (Mar 3, 2020). - Gitea version (or commit ref): 1.9.3 - Git version: 2.20.1 - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant - Log gist: I have been trying to create a pull request through the V1 API. The POST request I send is as follows: http://localhost:3000/api/v1/repos/anil/test/pulls?token=<TOKEN> Body: > { > "assignee": "anil", > "base": "master", > "head": "branch2", > "title": "Testing PR" > } I get the following response: > 422 Unprocessable Entity > [ > { > "fieldNames": [ > "Head" > ], > "classification": "RequiredError", > "message": "Required" > }, > { > "fieldNames": [ > "Base" > ], > "classification": "RequiredError", > "message": "Required" > }, > { > "fieldNames": [ > "Title" > ], > "classification": "RequiredError", > "message": "Required" > } > ] > I tried using a git repo (https://github.com/dblueai/giteapy) and I get the same response. Has something changed or am I not passing the parameters the right way?
GiteaMirror added the type/question label 2025-11-02 06:10:26 -06:00
Author
Owner

@jolheiser commented on GitHub (Mar 3, 2020):

Are you sending the content with the correct Content-Type ? It should be application/json.
What are you using to send the content?

@jolheiser commented on GitHub (Mar 3, 2020): Are you sending the content with the correct `Content-Type` ? It should be `application/json`. What are you using to send the content?
Author
Owner

@unnikrishnan-anil commented on GitHub (Mar 3, 2020):

That's what it was! Stupid of me. Thanks @jolheiser

@unnikrishnan-anil commented on GitHub (Mar 3, 2020): That's what it was! Stupid of me. Thanks @jolheiser
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4995