Home > Back-end >  cURL in Postman
cURL in Postman

Time:11-14

I am trying to import a cURL command into POSTMAN.

curl -X POST -H "Authorization: Bearer $API_KEY" https://api.astria.ai/tunes \
          -F tune[callback]="http://localhost/" \
          -F tune[title]="my portrait" \
          -F tune[branch]="fast" \
          -F tune[name]=person \
          -F "tune[images][][email protected]" \
          -F "tune[images][][email protected]" \
          -F "tune[images][][email protected]" \
          -F "tune[images][][email protected]"

{
  "id": 1,
  "images": [
    "http://assets.astria.ai/1.jpg",
    "http://assets.astria.ai/2.jpg",
    "http://assets.astria.ai/3.jpg",
    "http://assets.astria.ai/4.jpg"
  ],
  "name": "person",
  "steps": null,
  "ckpt_url": null,
  "created_at": "2022-10-06T14:06:09.088Z",
  "updated_at": "2022-10-06T14:06:09.139Z",
  "url": "http://api.astria.ai/tunes/26.json"
}

But I am getting this error:

Error while importing Curl: Only the URL can be provided without an option preceding it.All other inputs must be specified via options.

How can I fix it? Thanks for any help.

CodePudding user response:

I imported it into postman as a single line.

This imported:

curl -X POST -H "Authorization: Bearer $API_KEY" https://api.astria.ai/tunes -F tune[callback]="http://localhost/" -F tune[title]="my portrait" -F tune[branch]="fast" -F tune[name]=person -F "tune[images][][email protected]" -F "tune[images][][email protected]" -F "tune[images][][email protected]" -F "tune[images][][email protected]"


But postman is looking for the file names Select Files.

Postman


But if I removed the @, the file names imported.

enter image description here

curl -X POST -H "Authorization: Bearer $API_KEY" https://api.astria.ai/tunes -F tune[callback]="http://localhost/" -F tune[title]="my portrait" -F tune[branch]="fast" -F tune[name]=person -F "tune[images][]=1.jpg" -F "tune[images][]=2.jpg" -F "tune[images][]=3.jpg" -F "tune[images][]=4.jpg"
  • Related