New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Create snapshot with Vultr API in bash
I've try to do a weekly backup an Vultr instance according to https://www.vultr.com/api/#snapshot_create
My script is
date=$(date +"%Y_%m_%d")
DESCRIPTION="vps_"$date
API_KEY="my API key here"
echo "{'SUBID':32423432, 'description': '$DESCRIPTION'}" >> vultr.info
curl -i -X POST --data-binary @vultr.info https://api.vultr.com/v1/snapshot/create?api_key=$API_KEY --raw --trace-ascii /dev/stdout --header "Content-Type: text/plain" --connect-timeout 30`
The authentication is OK, but there is an error "Invalid server. Check SUBID value and ensure your API key matches the server's account"
Do you have some hint for me?
Thanks
Comments
Your SUBID value is probably wrong or in the wrong format?
It is very unlikely as I took it from https://api.vultr.com/v1/server/list?api_key=xyz
I guess the problem is in this line
But I don't know what is the correct way to pass the info to API
Just for fun, tried sending as regular post?
Edit: I should clarify I of course mean no JSON, just regular form post request.
You are perfectly right. I've just opened a ticket to Vultr and received the same answer. Just POST them as form variables (application/x-www-form-urlencoded) and it works.