DEV Community

Carrie
Carrie

Posted on

3 1 1 1 1

OpenAPI Tutorial for SafeLine WAF

SafeLine WAF supports API Token-based authentication.

Note: API documentation is not provided, but you can get it by yourself if needed.

Requirements

  • You must be logged in as the default admin user to access this feature.
  • Version must be >= 6.6.0.

Usage Instructions

  1. Create an API Token in the System Management section.

  1. Send a Request: Include the following additional parameter in the request header:
   "X-SLCE-API-TOKEN": "API Token generated in SafeLine"

### Example

Below is a Python example of using an API Token to add a site.

Enter fullscreen mode Exit fullscreen mode

import requests
import json

header = {
"X-SLCE-API-TOKEN": "Your API Token generated in SafeLine""
}

url = 'https://IP:9443/api/open/site'

request_playload = {
"ports":["80"],"server_names":["*"],
"upstreams":["http://127.0.0.1:9443"],"comment":"",
"load_balance":{"balance_type":1}
}

request_playload = json.dumps(request_playload)
requests.post(url=url,headers=header,data=request_playload,verify=False)


Enter fullscreen mode Exit fullscreen mode

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more