Skip to content

Instantly share code, notes, and snippets.

@epomatti
Created April 19, 2022 11:07
Show Gist options
  • Save epomatti/55fc47675550835678140b3fc5bf6ea1 to your computer and use it in GitHub Desktop.
Save epomatti/55fc47675550835678140b3fc5bf6ea1 to your computer and use it in GitHub Desktop.
Upload CSV file using CURL
#!/bin/bash
# Load Variables
source dev.local.env
# Decrypt the API password
api_password=$(gpg --decrypt --no-symkey-cache $pwd_encrypted_file)
# Authenticate to MuleSoft and get the token (requires jq to be installed)
access_token=$(curl -X POST -u $username:$api_password -d $auth_url | jq -r '.access_token')
# Uploads the file
response=$(curl -X POST -H "Authorization: Bearer $access_token" -F "file=@$file;type=text/csv" $url)\
echo $response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment