postman-app-support
postman-app-support copied to clipboard
Add ability to interact with Postman Pull Requests via API
Can you please add the ability to return any pull requests that exist and their status that are associated with any collection within the get collections endpoint in the Postman API. This should be added to both the single collection and all collections responses.
According to the documentation, it currently returns this:
{
"collection": {
"variables": [],
"info": {
"name": "Sample Collection",
"_postman_id": "f2e66c2e-5297-e4a5-739e-20cbb90900e3",
"description": "This is a sample collection that makes a tiny request to Postman Echo service to get the list of request headers sent by a HTTP client.",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"id": "82ee981b-e19f-962a-401e-ea34ebfb4848",
"name": "Request Headers",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var responseJSON;\ntry {\n tests[\"Body contains headers\"] = responseBody.has(\"headers\");\n responseJSON = JSON.parse(responseBody);\n tests[\"Header contains host\"] = \"host\" in responseJSON.headers;\n tests[\"Header contains test parameter sent as part of request header\"] = \"my-sample-header\" in responseJSON.headers;\n}\ncatch (e) { }\n\n\n\n"
}
}
],
"request": {
"url": "https://echo.getpostman.com/headers",
"method": "GET",
"header": [
{
"key": "my-sample-header",
"value": "Lorem ipsum dolor sit amet",
"description": ""
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"description": ""
},
"response": []
}
]
}
}
My request would be to add to the info object so that there is a new object within it called pullrequest and it would contain an array of the pull requests that exist on a collection with associated information for each pull request (title, description, status, created date, and the date it was last updated. The array would be sorted by the created date since only one pull request can be open at a time per collection this would list the most recent pull request at the top of the array.
Here is what I am proposing:
{
"collection": {
"variables": [],
"info": {
"name": "Sample Collection",
"_postman_id": "f2e66c2e-5297-e4a5-739e-20cbb90900e3",
"description": "This is a sample collection that makes a tiny request to Postman Echo service to get the list of request headers sent by a HTTP client.",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
"pullrequest": [
{
"title": "Ticket 123 - Fix bug",
"description": "fixing a bug",
"status": "open",
"created": "2021-04-22T15:00:12.123456",
"lastupdated": "2021-04-22T15:03:14.123756"
},
{
"title": "Ticket 120 - Fixed bug",
"description": "fixed a different bug",
"status": "merged",
"created": "2021-04-15T15:28:12.123496",
"lastupdated": "2021-04-19T18:34:00.523456"
},
{
"title": "Ticket 120 - Fixed bug",
"description": "tried to fix a different bug",
"status": "declined",
"created": "2021-04-01T15:10:36.623056",
"lastupdated": "2021-04-05T01:40:24.723356"
}
]
},
"item": [
{
"id": "82ee981b-e19f-962a-401e-ea34ebfb4848",
"name": "Request Headers",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "var responseJSON;\ntry {\n tests[\"Body contains headers\"] = responseBody.has(\"headers\");\n responseJSON = JSON.parse(responseBody);\n tests[\"Header contains host\"] = \"host\" in responseJSON.headers;\n tests[\"Header contains test parameter sent as part of request header\"] = \"my-sample-header\" in responseJSON.headers;\n}\ncatch (e) { }\n\n\n\n"
}
}
],
"request": {
"url": "https://echo.getpostman.com/headers",
"method": "GET",
"header": [
{
"key": "my-sample-header",
"value": "Lorem ipsum dolor sit amet",
"description": ""
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"description": ""
},
"response": []
}
]
}
}
@silverbullettruck2001 Thank you so much for filing this feature request. We are working towards improving our API support for pull requests as well as the entire version control offerings in Postman. Will update this thread once we release the improvements.
I would suggest adding to the data in the example a URL linking to the web view for the pull request, as well.
The workflow I would like to support is a Slack bot that posts all of our team's PRs once per day. If we could get a list of the Postman PRs through the API, we could also include those in our list for people to look at.
We have added a lot of new functionalities to the forks and pull requests endpoints in the Postman API. We are working on more endpoints (like listing the PRs of a collection), that will cover your use case. We will update this ticket once all the new endpoints are available publicly.
Thanks for your suggestion and for being patient. We have added in total of 4 APIs related to pull-requests feature. Kindly have a look at them.