Netskope Global Technical Success (GTS)
KB - How to automate URL List Updates via API
Netskope Cloud Version - 120
Objective
Demonstrate the process of automating URL list updates via API.
Prerequisite
Netskope SWG License
Context
Netskope enables users to create, delete, and update URL lists using API calls. This knowledge base article provides step-by-step details for managing URL lists programmatically, helping streamline and automate URL list maintenance.
Use Case
- When migrating a large list of URLs (e.g., 1000 URLs) from a third-party solution to Netskope, manual transfers can be cumbersome, especially with dynamically updated feeds. Even if URLs can be exported to CSV, you’d still need to format them correctly and repeatedly import them to stay current with updates.
- By automating URL list updates from an online JSON feed, you can streamline the transfer process, enabling a centralized, up-to-date URL store across multi-vendor proxy environments. This approach reduces manual effort and keeps your lists synchronized with minimal intervention.
Demonstration
This process requires three API endpoint as shown below :
https://achadha.goskope.com/api/v2/policy/urllist
https://achadha.goskope.com/api/v2/policy/urllist/deploy
https://achadha.goskope.com/api/v2/policy/urllist/file
- Create a new token with the below permissions:
Path: Netskope Tenant UI >>> Settings >>> Tools >>> Rest API V2
- Click on “Save” and then copy the token
- Now click on API Documentation and go to the Swagger UI
Path: Netskope Tenant UI >>> Settings >>> Tools >>> Rest API V2
- On the Swagger UI, click on Authorise (at the top), enter the token created/copied above.
- You can also use Postman for running any of the below API calls after successful authentication using the Bearer token.
- Now search for “urllist” and click on “Try it Out” for any of the below commands:
1. Get all applied and pending URL lists
2. Create a new URL list.
POST /api/v2/policy/urllist
3. Apply pending URL list changes.
POST /api/v2/policy/urllist/deploy
4. Upload multiple configurations via a JSON file
POST /api/v2/policy/urllist/file
5. Delete a URL list.
DELETE /api/v2/policy/urllist/{id}
6. Get URL list by ID.
GET /api/v2/policy/urllist/{id}
7. Replace a URL list configuration.
PUT /api/v2/policy/urllist/{id}
8. Patch URL list
PATCH /api/v2/policy/urllist/{id}/{action}
Example:
- Get all applied and pending URL lists
Returns an array of URL list objects containing ID, name, URLs, type, modify type, modify by, modify time, and pending information.
- Create a new URL list
- Apply pending URL list changes
Applies currently pending changes for URL lists. To ensure efficiency, avoid unnecessary network overhead and reliable deployments, we recommend batching all desired changes and applying them in a single deploy call rather than making single changes and initiating multiple deploy calls.
- Upload multiple configurations via a JSON file
Note:
- Upload multiple URL list configurations via a JSON file.
- URL lists NOT containing an ID will create new URL lists.
- URL lists containing an ID will replace an existing URL list with the same ID.
Important:
URLs in the list must follow certain formats. Here are the rules for URLs in this list.
URL Format | Matched URLs |
www.example.com/path/to/resource | www.example.com/path/to/resource/a, www.example.com/path/to/resource/a/b |
example.com | example.com/, example.com/path/a |
www.example.com | www.example.com, www.example.com/path/a, www.example.com/some/path, www.example.com/query?a=b |
*.example.com | www.example.com, www.us.example.com, www.uk.example.com "*.example.com" does not include "example.com”. A separate entry must be created for "example.com". |
www.example.com/path/*/ | Not Supported |
www.example.com/*, www.example.com/path/* | Not Supported |
- Delete a URL list
Mark a URL list as pending deletion.
- Get URl List by ID
Get the configuration of the given URL list ID.
- Replace a URL List Configuration
Completely replace the configuration of the given URL list ID.
- Patch URL List
Update name, URLs, and/or type of URL list object.
Terms and Conditions
- Up to 500 hashes can be submitted in a Batch request ('getinfo’ endpoint)
- In the future, If any such platform changes are brought to our attention, we will promptly update the documentation to reflect them.
Notes
- This article is authored by Netskope Global Technical Success (GTS).
- For any further inquiries related to this article, please contact Netskope GTS by submitting a support case with 'Case Type – How To Questions'.