Never spend time again to create awesome screenshots of your websites.
Simple Script to use the Websiteshot API.
-h, --help Print this help and exit
-v, --verbose Print script debug info
-p, --project Argument: ProjectId
-a, --apikey Argument: API Key
-t, --template Argument: TemplateId
-j, --job Argument: JobId
-w, --website Argument: URL of Website
-vw, --width Argument: Width of View
-vh, --height Argument: Height of View
-c, --create Creates a new Screenshot Job
-g, --get Get needed data for JobId
-d, --download Download first Screenshot of Job
You need a Project at Websiteshot and an API Key. Set both as environment variables:
export PROJECT=...
export APIKEY=...
If you want to trigger a Screenshot by Template Id add an environment variable for the template:
export TEMPLATE=...
The Script uses cURL and jq. Both tools need to be installed on your system.
./simple-script.sh -a $APIKEY -p $PROJECT -c
Or by Template Id:
./simple-script.sh -a $APIKEY -p $PROJECT -t $TEMPLATE -c
The Script executes the follwing cURL command:
curl -H 'Authorization: '"${apikey}"'' -H "Content-Type: application/json" -d '{"screenshotParameter":{"width":'"${width}"', "height":'"${height}"'}, "urls":[{"url":"'"${website}"'", "name":"'"${website}"'"}]}' -X POST ${baseurl}/api/projects/${project}
Output:
Create Request for Project abcdef...
Project: abcdef...
Website: https://websiteshot.app
Job: abcdef...
Screenshot Url: unset
Width: 1200
Height: 720
./simple-script.sh -a $APIKEY -p $PROJECT -j $JOBID -g
Output:
Get Request for Job abcdef... of Project abcdef...
Project: abcdef...
Website: https://websiteshot.app
Job: abcdef...
Screenshot Url: https://...
Width: 1200
Height: 720
./simple-script.sh -a $APIKEY -p $PROJECT -j $JOBID -d