Skip to content

Commit 331e1cb

Browse files
committed
PUT not POST
1 parent da42bbd commit 331e1cb

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
## [1.0.1] - 2025-06-18
11-
1210
### Added
1311
- Response examples for all endpoints
1412

scripts/publish_postman.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def publish_to_postman(file_path, workspace_id, api_key, is_collection=True):
3030
}
3131

3232
if is_collection:
33-
endpoint = f"{POSTMAN_API_BASE}/collections"
33+
endpoint = f"{POSTMAN_API_BASE}/collections/{os.getenv('POSTMAN_COLLECTION_ID')}"
3434
payload["collection"] = data
3535
else:
36-
endpoint = f"{POSTMAN_API_BASE}/environments"
36+
endpoint = f"{POSTMAN_API_BASE}/environments/{os.getenv('POSTMAN_ENVIRONMENT_ID')}"
3737
payload["environment"] = data
3838

3939
headers = {
@@ -42,7 +42,7 @@ def publish_to_postman(file_path, workspace_id, api_key, is_collection=True):
4242
}
4343

4444
try:
45-
response = requests.post(endpoint, json=payload, headers=headers)
45+
response = requests.put(endpoint, json=payload, headers=headers)
4646
response.raise_for_status()
4747
print(f"Successfully published {'collection' if is_collection else 'environment'}: {file_path}")
4848
return response.json()
@@ -56,9 +56,11 @@ def main():
5656
# Check for required environment variables
5757
api_key = os.getenv('POSTMAN_API_KEY')
5858
workspace_id = os.getenv('POSTMAN_WORKSPACE_ID')
59+
collection_id = os.getenv('POSTMAN_COLLECTION_ID')
60+
environment_id = os.getenv('POSTMAN_ENVIRONMENT_ID')
5961

60-
if not api_key or not workspace_id:
61-
print("Error: POSTMAN_API_KEY and POSTMAN_WORKSPACE_ID environment variables must be set")
62+
if not all([api_key, workspace_id, collection_id, environment_id]):
63+
print("Error: POSTMAN_API_KEY, POSTMAN_WORKSPACE_ID, POSTMAN_COLLECTION_ID, and POSTMAN_ENVIRONMENT_ID environment variables must be set")
6264
sys.exit(1)
6365

6466
# Get the directory containing the Postman files

0 commit comments

Comments
 (0)