diff --git a/.github/workflows/sync-admin.yml b/.github/workflows/sync-admin.yml index ed047fb..387d154 100644 --- a/.github/workflows/sync-admin.yml +++ b/.github/workflows/sync-admin.yml @@ -24,9 +24,18 @@ jobs: SCHEMA_ID=${{vars.ADMIN_DEFINITION_ID}} FILE_PATH="index.json" - CONTENT=$(jq -Rs . < ${SWAGGER_FILE}) + # 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 "{\"content\": ${CONTENT}}" \ No newline at end of file + --header "Accept: application/vnd.api.v10+json" \ + --header "Content-Type: application/json" \ + --header "X-Api-Key: $POSTMAN_API_KEY" \ + --data-binary @payload.json \ No newline at end of file diff --git a/.github/workflows/sync-click.yml b/.github/workflows/sync-click.yml index d697777..b7052c1 100644 --- a/.github/workflows/sync-click.yml +++ b/.github/workflows/sync-click.yml @@ -24,9 +24,18 @@ jobs: SCHEMA_ID=${{vars.DEFINITION_ID}} FILE_PATH="click/schema.json" - CONTENT=$(jq -Rs . < ${SWAGGER_FILE}) + # 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 "{\"content\": ${CONTENT}}" \ No newline at end of file + --header "Accept: application/vnd.api.v10+json" \ + --header "Content-Type: application/json" \ + --header "X-Api-Key: $POSTMAN_API_KEY" \ + --data-binary @payload.json \ No newline at end of file diff --git a/.github/workflows/sync-connect.yml b/.github/workflows/sync-connect.yml index 1b38718..21f1c9e 100644 --- a/.github/workflows/sync-connect.yml +++ b/.github/workflows/sync-connect.yml @@ -24,9 +24,18 @@ jobs: SCHEMA_ID=${{vars.CONNECT_DEFINITION_ID}} FILE_PATH="index.json" - CONTENT=$(jq -Rs . < ${SWAGGER_FILE}) + # 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 "{\"content\": ${CONTENT}}" \ No newline at end of file + --header "Accept: application/vnd.api.v10+json" \ + --header "Content-Type: application/json" \ + --header "X-Api-Key: $POSTMAN_API_KEY" \ + --data-binary @payload.json \ No newline at end of file diff --git a/.github/workflows/sync-esign.yml b/.github/workflows/sync-esign.yml index d115bc4..a0f82bb 100644 --- a/.github/workflows/sync-esign.yml +++ b/.github/workflows/sync-esign.yml @@ -24,9 +24,18 @@ jobs: SCHEMA_ID=${{vars.ESIGN_DEFINITION_ID}} FILE_PATH="index.json" - CONTENT=$(jq -Rs . < ${SWAGGER_FILE}) + # 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 "{\"content\": ${CONTENT}}" \ No newline at end of file + --header "Accept: application/vnd.api.v10+json" \ + --header "Content-Type: application/json" \ + --header "X-Api-Key: $POSTMAN_API_KEY" \ + --data-binary @payload.json \ No newline at end of file diff --git a/.github/workflows/sync-maestro.yml b/.github/workflows/sync-maestro.yml index 35d9c92..5386259 100644 --- a/.github/workflows/sync-maestro.yml +++ b/.github/workflows/sync-maestro.yml @@ -24,9 +24,18 @@ jobs: SCHEMA_ID=${{vars.MAESTRO_DEFINITION_ID}} FILE_PATH="index.json" - CONTENT=$(jq -Rs . < ${SWAGGER_FILE}) + # 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 "{\"content\": ${CONTENT}}" \ No newline at end of file + --header "Accept: application/vnd.api.v10+json" \ + --header "Content-Type: application/json" \ + --header "X-Api-Key: $POSTMAN_API_KEY" \ + --data-binary @payload.json \ No newline at end of file diff --git a/.github/workflows/sync-monitor.yml b/.github/workflows/sync-monitor.yml index abd0e92..8f8ef61 100644 --- a/.github/workflows/sync-monitor.yml +++ b/.github/workflows/sync-monitor.yml @@ -24,9 +24,18 @@ jobs: SCHEMA_ID=${{vars.MONITOR_DEFINITION_ID}} FILE_PATH="index.json" - CONTENT=$(jq -Rs . < ${SWAGGER_FILE}) + # 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 "{\"content\": ${CONTENT}}" \ No newline at end of file + --header "Accept: application/vnd.api.v10+json" \ + --header "Content-Type: application/json" \ + --header "X-Api-Key: $POSTMAN_API_KEY" \ + --data-binary @payload.json \ No newline at end of file diff --git a/.github/workflows/sync-rooms.yml b/.github/workflows/sync-rooms.yml index 634cc3b..7be47cd 100644 --- a/.github/workflows/sync-rooms.yml +++ b/.github/workflows/sync-rooms.yml @@ -24,9 +24,18 @@ jobs: SCHEMA_ID=${{vars.ROOMS_DEFINITION_ID}} FILE_PATH="index.json" - CONTENT=$(jq -Rs . < ${SWAGGER_FILE}) + # 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 "{\"content\": ${CONTENT}}" \ No newline at end of file + --header "Accept: application/vnd.api.v10+json" \ + --header "Content-Type: application/json" \ + --header "X-Api-Key: $POSTMAN_API_KEY" \ + --data-binary @payload.json \ No newline at end of file diff --git a/.github/workflows/sync-webforms.yml b/.github/workflows/sync-webforms.yml index 644e520..920ddba 100644 --- a/.github/workflows/sync-webforms.yml +++ b/.github/workflows/sync-webforms.yml @@ -24,9 +24,18 @@ jobs: SCHEMA_ID=${{vars.WEBFORMS_DEFINITION_ID}} FILE_PATH="index.json" - CONTENT=$(jq -Rs . < ${SWAGGER_FILE}) + # 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 "{\"content\": ${CONTENT}}" \ No newline at end of file + --header "Accept: application/vnd.api.v10+json" \ + --header "Content-Type: application/json" \ + --header "X-Api-Key: $POSTMAN_API_KEY" \ + --data-binary @payload.json \ No newline at end of file