Issue getting database ID in api

Hi,

I’m attempting to use the sequence server api following the instructions on https://sequenceserver.com/doc/api/. The issue I’m having is with getting the database id from my localhost:4567 (which is working). The command I’m using to get the ID is: curl $http://localhost:4567/searchdata.json | jq --raw-output ‘.database[].id’
The error I get back is curl: (1) Protocol “” not supported or disabled in libcurl
If I remove the $ and/or the http:// I get back a number that looks like a database ID but if I try to perform a query with it, it says zsh: no matches found: -Fdatabases[]=the id

Thanks for your help,
Simon

UPDATE: I got it working with the shell script provided, so I’m assuming it’s an issue with my api command not getting the ID.
The command I used was: curl -v -X POST -Fsequence=sequence -Fmethod=blastp -Fdatabases[]=theID http://localhost:4567
I get back: no matches found: -Fdatabases[]=theID

Hi Simon,

Glad you got it working. For the first part of your first message I think the issue is that the API doc page is using $BASEURL as a variable where you are expected to replace $BASEURL with the URL for your SequenceServer.

e.g.

curl $BASEURL/searchdata.json | jq --raw-output '.database[].id'

becomes

curl http://localhost:4567/searchdata.json | jq --raw-output '.database[].id'

From your message it appears that you left the $ in so your zsh is trying to replace it with something, not finding a variable and passing curl an invalid URL.

The second issue is also zsh related. Square brackets [] have special meaning in zsh. If you need to use them for a purpose other than what zsh expects then you need to put them in quotes (single or double) so that zsh knows to treat them as a string.

curl -v -X POST -Fsequence=ATGTTACCACCAACTATTAGAATTTCAG -Fmethod=blastn -F 'databases[]=theID'

I hope this helps.

1 Like