syncCollectionWithSpec
Synchronize a Postman collection with its OpenAPI specification. Async endpoint returns 202 for OpenAPI 2.0, 3.0, and 3.1.
Instructions
Syncs a collection generated from an API spec. Async endpoint returns 202. Only for OpenAPI 2.0/3.0/3.1.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| specId | Yes | Spec ID | |
| collectionUid | Yes | Collection unique ID |
Implementation Reference
- tools/postman_tools.py:1429-1460 (handler)The SyncCollectionWithSpecTool class handles the 'syncCollectionWithSpec' tool. It sends a PUT request to /apis/{specId}/collections/{collectionUid}/sync to sync a collection generated from an API spec. Requires specId and collectionUid as input parameters.
class SyncCollectionWithSpecTool(ToolHandler): """Sync collection with spec""" def __init__(self): super().__init__("syncCollectionWithSpec") def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Syncs a collection generated from an API spec. Async endpoint returns 202. Only for OpenAPI 2.0/3.0/3.1.", inputSchema={ "type": "object", "properties": { "specId": { "type": "string", "description": "Spec ID" }, "collectionUid": { "type": "string", "description": "Collection unique ID" } }, "required": ["specId", "collectionUid"] }, ) async def run_tool(self, args: dict) -> list[TextContent]: spec_id = args["specId"] collection_uid = args["collectionUid"] result = await postman_api_call("PUT", f"/apis/{spec_id}/collections/{collection_uid}/sync") return [TextContent(type="text", text=json.dumps(result, indent=2))] - tools/postman_tools.py:1880-1880 (registration)The tool is registered in the register_all_tools() function at line 1880, which returns a list of all ToolHandler instances.
SyncCollectionWithSpecTool(), - tools/postman_tools.py:1435-1453 (schema)The input schema (inside get_tool_description) defines two required string properties: specId and collectionUid.
def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Syncs a collection generated from an API spec. Async endpoint returns 202. Only for OpenAPI 2.0/3.0/3.1.", inputSchema={ "type": "object", "properties": { "specId": { "type": "string", "description": "Spec ID" }, "collectionUid": { "type": "string", "description": "Collection unique ID" } }, "required": ["specId", "collectionUid"] }, )