micha / resty

Little command line REST client that you can use in pipelines (bash or zsh).
MIT License
2.65k stars 143 forks source link

Resty not loading in Shell #83

Open bewheele opened 6 years ago

bewheele commented 6 years ago

I'm following the git instructions, but I am unable to successfully load resty in the shell on a Mac. I wanted to ask if I'm mis-understanding the source syntax

When trying to execute the following script, it seems resty takes no action (there are no errors being thrown on the target server), nor in the Terminal

I've installed resty via the git install method. The same POST command works on a single file I execute in the shell via resty (so I know resty is correctly added to my Path, and I know the command syntax is good...)

Also - the script below works to upload all files in the referenced folder if I replace the resty line with a curl command - it's just the resty source part that seems not to work.

Any help appreciated - I'd much prefer resty to using straight curl syntax!

#!/bin/bash
dir="/Users/bewheele/Downloads/Images"
 for file in `find $dir -type f`
  do
  filename=`basename $file`;
  echo $file
   # Load resty, don't write to the history file, and set the URI base
  . /Users/bewheele/resty -W 'http://localhost:4504 -u admin:admin' POST /api/assets/myfolder/* -F"name=$filename" -F"file=@$file"
done
hassanfarid commented 4 years ago

Try to expand aliases in the shell. This works for me.

#!/bin/bash
shopt -s expand_aliases

Ref: https://github.com/micha/resty/issues/87