Last active
August 10, 2021 21:53
-
-
Save sfdcale/e3fc6902ad2437439f175ac8eb4ab9ce to your computer and use it in GitHub Desktop.
Shortcut on how to read instance url and access token from SFDX CLI and use that in curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sfdx force:org:display --targetusername sandbox --json | jq -r '[.result.instanceUrl,.result.accessToken] | @tsv' \ | |
| | xargs -t sh -c 'curl -i --location $1/services/data/v50.0/sobjects/ContentVersion \ | |
| --header "Authorization: Bearer $2" \ | |
| --form entity_content='\''{ "PathOnClient": "Statement.pdf" };type=application/json'\'' \ | |
| --form VersionData="@Metecho Training.pdf;type=application/octset-stream;"' sh | |
| # Make sure that there is a file named `@Metecho Training.pdf` in the location where this command is run from. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment