Options

You can pass additional options to a job to modify the behavior of an export.

Add options

cURL
curl -X "POST" "https://api.webtozip.com/rest/v1/options" \
     -H 'apikey: WTZ_API_KEY' \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer WTZ_BEARER_TOKEN' \
     -d $'{
  "mode": "relative",
  "relative_path": "/subdirectory"
}'
JavaScript (fetch)
fetch("https://api.webtozip.com/rest/v1/options", {
      "method": "POST",
      "headers": {
            "apikey": "WTZ_API_KEY",
            "Content-Type": "application/json",
            "Authorization": "Bearer WTZ_BEARER_TOKEN",
      },
      "body": "{\"mode\":\"relative\",\"relative_path\":\"/subdirectory\"}"
})
.then((res) => res.text())
.then(console.log.bind(console))
.catch(console.error.bind(console));
Response

You get a 201 response on success.

Parameters

Options can be used to control the export mode when downloading websites.

mode

Choose between offline, relative, and absolute

relative_path

You must add relative_path as an additional argument if you choose relative as a mode.

replace_url

You must add replace_url as an additional argument if you choose absolute as a mode.

Get Options

cURL
curl "https://api.webtozip.com/rest/v1/options?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/options?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 options associated with your account:

[
  {
    "id": 123,
    "created_at": "XXX",
    "job_id": XX,
    "mode": "offline",
    "relative_path": "/",
    "replace_url": ""
  },
  {
    "id": 345,
    "created_at": "XXX",
    "job_id": XX,
    "mode": "absolute",
    "relative_path": "/",
    "replace_url": "https://mystaticsite.com"
  }
]

Update an option

You can use any unique identifier to update a specific option.

However, we recommend using the ID to be as specific as possible.

You can get the ID by getting the options and filtering out the specific result you want to update.

cURL
curl -X "PATCH" "https://api.webtozip.com/rest/v1/options?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/options?id=eq.123", {
      "method": "PATCH",
      "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.

Delete an option

You can use any unique identifier to delete a specific option.

However, we recommend using the ID to be as specific as possible.

You can get the ID by getting the options and filtering out the specific result you want to update.

cURL
curl -X "DELETE" "https://api.webtozip.com/rest/v1/options?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/options?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