Skip to content

Merge pull request #111 from docusign/dev_mudit #1

Merge pull request #111 from docusign/dev_mudit

Merge pull request #111 from docusign/dev_mudit #1

Workflow file for this run

name: Postman API Integration for Monitor
on:
push:
branches:
- master
paths:
- 'monitor.rest.swagger-v2.0.json'
jobs:
upload-swagger:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Send Swagger Spec to Postman API Monitor
env:
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
run: |
SWAGGER_FILE="./monitor.rest.swagger-v2.0.json"
API_ID=${{vars.MONITOR_API_ID}}
SCHEMA_ID=${{vars.MONITOR_DEFINITION_ID}}
FILE_PATH="index.json"
# Read the Swagger file content and escape it properly for JSON
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
# Create the JSON payload with the file content as a string
JSON_PAYLOAD="{\"content\": $CONTENT}"
# Write the JSON payload to a temporary file
echo "$JSON_PAYLOAD" > payload.json
# Use curl with --data-binary to handle large file content
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
--header "Accept: application/vnd.api.v10+json" \
--header "Content-Type: application/json" \
--header "X-Api-Key: $POSTMAN_API_KEY" \
--data-binary @payload.json