Share via

Azure API - Create Pull Request - Cannot create PR from forked repo to upstream repo

Hundare, N.V. (Nikhil) 0 Reputation points
2024-10-16T11:51:06.9+00:00

Hello,

I am working on creating a Pull Request from my forked repo to upstream repo (original repo from where the fork was created) via azure api version 7.1. Unfortunately, my pull request gets created on the same forked repo against the target branch. Here is my code:

az rest --resource 499b84ac-1321-427f-aa17-267ca6975798 --method post --url https://dev.azure.com/
Community Center | Not monitored
0 comments No comments

1 answer

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 17,871 Reputation points Moderator
    2024-10-16T13:43:37.9333333+00:00

    Hi @Hundare, N.V. (Nikhil) Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.As per the documentation of the API Pull Requests - Create the repository ID in the API URL has to be the repository ID of the pull request's target branch.

    In your case the URL request has to point to the upstream repo Id but not the fork repo Id. The repository property of the request body holds the information on the target branch of the pull request, i.e., upstream repository. Since you are passing the Fork repo Id in the URL and passing the upstream branch Is in the repository property of the body, the request fails due to mismatched Id.

    Hope this helps! Please let us know if you need any additional information or further assistance.

    PS: For any future issues related to Azure DevOps, please reach out to Azure DevOps Developer community


    If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.