The process of downloading a website is called a Job.
Add a job
cURL
curl -X "POST" "https://api.webtozip.com/rest/v1/jobs" \
-H 'apikey: WTZ_API_KEY' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer WTZ_BEARER_TOKEN' \
-d $'{
"url": "https://mywebsite.com",
"email": "api@webtozip.com"
}'
JavaScript (fetch)
fetch("https://api.webtozip.com/rest/v1/jobs", {
"method": "POST",
"headers": {
"apikey": "WTZ_API_KEY",
"Content-Type": "application/json",
"Authorization": "Bearer WTZ_BEARER_TOKEN",
},
"body": "{\"url\":\"https://mywebsite.com\",\"email\":\"api@webtozip.com\"}"
})
.then((res) => res.text())
.then(console.log.bind(console))
.catch(console.error.bind(console));
Response
You get a 201 response on success.
Parameters
url
The URL you want to download.
The e-mail address to receive the download link.
Get Jobs
cURL
curl "https://api.webtozip.com/rest/v1/jobs?select=*" \
-H 'apikey: WTZ_API_KEY' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer WTZ_BEARER_TOKEN' \
-d $'{
"url": "https://mywebsite.com",
"email": "api@webtozip.com"
}'
JavaScript (fetch)
fetch("https://api.webtozip.com/rest/v1/jobs?select=*", {
"method": "GET",
"headers": {
"apikey": "WTZ_API_KEY",
"Content-Type": "application/json",
"Authorization": "Bearer WTZ_BEARER_TOKEN",
}
})
.then((res) => res.text())
.then(console.log.bind(console))
.catch(console.error.bind(console));
Response
You get a 200 code and a JSON object in return containing all jobs associated with your account:
[
{
"id": XX,
"created_at": "XXX",
"user_id": "XXX",
"status": "finished",
"files": 37,
"url": "https://mywebsite.com",
"email": "me@mail.com",
"plan": "pro"
},
{
"id": XX,
"created_at": "XXX",
"user_id": "XXX",
"status": "finished",
"files": 112,
"url": "https://mysecondwebsite.com",
"email": "me@mail.com",
"plan": "pro"
}
]
Update a job
You can use any unique identifier to update a specific job.
However, we recommend using the ID to be as specific as possible.
You can get the ID by getting the jobs and filtering out the specific result you want to update.
cURL
curl -X "PATCH" "https://api.webtozip.com/rest/v1/jobs?id=eq.123" \
-H 'apikey: WTZ_API_KEY' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer WTZ_BEARER_TOKEN' \
-d $'{
"url": "https://mywebsite.com"
}'
JavaScript (fetch)
fetch("https://api.webtozip.com/rest/v1/jobs?id=eq.123", {
"method": "PATCH",
"headers": {
"apikey": "WTZ_API_KEY",
"Content-Type": "application/json",
"Authorization": "Bearer WTZ_BEARER_TOKEN",
},
"body": "{\"url\":\"https://mywebsite.com\"}"
})
.then((res) => res.text())
.then(console.log.bind(console))
.catch(console.error.bind(console));
Response
You get a 204 code as a return.
Delete a job
You can use any unique identifier to delete a specific job.
However, we recommend using the ID to be as specific as possible.
You can get the ID by getting the jobs and filtering out the specific result you want to update.
cURL
curl -X "DELETE" "https://api.webtozip.com/rest/v1/jobs?id=eq.123" \
-H 'apikey: WTZ_API_KEY' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer WTZ_BEARER_TOKEN' \
-d $'{
"id": "123"
}'
JavaScript (fetch)
fetch("https://api.webtozip.com/rest/v1/jobs?id=eq.123", {
"method": "DELETE",
"headers": {
"apikey": "WTZ_API_KEY",
"Content-Type": "application/json",
"Authorization": "Bearer WTZ_BEARER_TOKEN",
},
"body": "{\"id\":\"123\"}"
})
.then((res) => res.text())
.then(console.log.bind(console))
.catch(console.error.bind(console));
Response
You get a 204 code as a return.
Please replace WTZ_API_KEY with your own API key. Please replace WTZ_BEARER_TOKEN with your own Bearer Token