Skip to content

one liner curl equivalent #1

@thiswillbeyourgithub

Description

@thiswillbeyourgithub

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions