Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one liner curl equivalent #1

Open
thiswillbeyourgithub opened this issue Apr 21, 2023 · 0 comments
Open

one liner curl equivalent #1

thiswillbeyourgithub opened this issue Apr 21, 2023 · 0 comments

Comments

@thiswillbeyourgithub
Copy link

Hi!

I don't know how to usetypescript so I asked ChatGPT to comeup with a curl oneliner. I thought it could be useful to others:

API_KEY="todo"
filename="todo.csv"
curl -X POST -H "Authorization: $API_KEY" -H "Content-Type: application/json" -d '{"query":"mutation UploadImportFile($type: UploadImportFileType!, $contentType: String!) { uploadImportFile(type: $type, contentType: $contentType) { ... on UploadImportFileError { errorCodes } ... on UploadImportFileSuccess { uploadSignedUrl } } }","variables":{"type":"URL_LIST","contentType":"text/csv"}}' "https://api-prod.omnivore.app/api/graphql/api/graphql" | jq -r '.data.uploadImportFile.uploadSignedUrl' | \xargs curl -X PUT -H "Content-Type: text/csv" --data-binary "@$filename"

Seems to work ok but am noobish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant