Skip to main content

AD_4nXcNCJaUpWcyD8cT6TS4MWjjWUsFlCYVONIxTasFXSdbiLV1rwUmk-XpuYuJDD61jBxeqaj5JvWsZNNt-v5ZKZCFzLD55O__StxuTyBawtumS0e8jcbNnLzFjWisKknj3Z6by7TvQeSemYfqsjRxihKneZKH?key=2rvtIlEza36V5n18yFvA_g

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

AD_4nXcYRvupmEU74t-rfXwhWigN3l4XtU_b1DzcAPvznq7fF-VqUr-wQ_C78mFH3yv0qtqmD8IPInWonrWSF_O95spoPSABNOkmG_8NbN6gdNACQsLraWmdOeEep6QgKvh4KdF1PYo-pKurWSy4NjXofLVT9mnb?key=ohXEd0bonMVYOWE2WqpxGA

 

  • Click on “Save” and then copy the token

AD_4nXd6iZCuhMTOCYo_3uHY1oMq9pNI6_hRkpe_AdKpG4DvDq49fgm6JPh31HefpLAKCZRipJ6qiajyrcIMrubUBNsqo844VDUW03ikwhvKu_9uOXr_7k_SeWngawvidKumsCah56FOWIJKhkSNMDReE0mZ00DB?key=ohXEd0bonMVYOWE2WqpxGA

 

  • Now click on API Documentation and go to the Swagger UI

Path: Netskope Tenant UI >>> Settings >>> Tools >>> Rest API V2

AD_4nXePwHuwoYnXyfibVO6UOpanjtPcjHOiTYhSdGs2SNWGhCmGlevX7ByM7N1KNNpPkdCXyoKyu663c3rvmszhypSM-3q_xHqvlrYes2zIzWiYrHbzufzTaNRKUZYz7dykABxwkLx8fiiRAnZZrDfNCd_qrAE8?key=ohXEd0bonMVYOWE2WqpxGA

 

  • 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.
     

AD_4nXeF-m9NAGOJoG1dv-Ffg5qj_wsI1Gho_HcACdd6heXWA6GVKfw8ikJpvrOp_iOW4lJDoR4qQpZuGPEvIGbDiMINA_RFOIqWxUpxPu6BFoei9HpFNOSX45qkPdu4FSjtwLEk0Dq6kep8VqTYDmQzm8z4Dlg6?key=ohXEd0bonMVYOWE2WqpxGA
 

  • Now search for “urllist” and click on “Try it Out” for any of the below commands:

1. Get all applied and pending URL lists
 

GET        /api/v2/policy/urllist

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.

AD_4nXdRuvnViu9zIePJE4Gp8KUsOQvbI4Y1CCvGrAmJcncfeTMbF828G7hm14ltPRRZiohlJ400eb7qwV6Es5tR0bX7Al5vohnh45fPj_DO3-bP_NNoOyHh7sqt4rv9xU147cnrQkgi3I4D3fe8gNym8QVVD-Q1?key=ohXEd0bonMVYOWE2WqpxGA

 

  • Create a new URL list

AD_4nXd0PX_yVI6Pz6T3mLbPTWIrLTINOuIloHq5WTQTeuFDG3oLbkt-PmINv3v1YnNGYXiB3cwW4KqNns9G7zegD-pTDaqU3B-JnZTdFZZDp-q6RBcWNZGaOoOpG5bQ0grpmT6a0wud6wMNAG0i1fMlmfbEt9sh?key=ohXEd0bonMVYOWE2WqpxGA

 

  • 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.

AD_4nXfQQP-ZS0yblRpgEyfizmQ9p3kIB6xff-88EzM8HPmfU0WabS8ZHJRUg-2pYRknWqHefS7OU3wzSSWD2XQeRGS3DgLBwX2n7IReIbY0wBWBlIJjOivGTrSwZhNJXR2hOQj7WRiaAKa9pDM-gJHI8abcwV6K?key=ohXEd0bonMVYOWE2WqpxGA

 

  • Upload multiple configurations via a JSON file

Note:

  1. Upload multiple URL list configurations via a JSON file.
  2. URL lists NOT containing an ID will create new URL lists.
  3. 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

 

AD_4nXdHUNxtmKpCxpxvmxQmS5gfj6cXa5g3gEvR5Z523bxTOVbkxw1dl9bjdZN2Nc75PBs7zvv9-8boVrsMndWxN2N4qqJ7y-lVXM1b1WsutYDNr-k-8HbgN9PAsQ2p4G9ZOedGsEIu_bSr9v0G2JLR5wUeQQFH?key=ohXEd0bonMVYOWE2WqpxGA

 

  • Delete a URL list

Mark a URL list as pending deletion.

AD_4nXfRL9JJlMVcxl9JhZ9w-AlfqJ-n8uSJ0JdqmtrsvYsMfVbQTJECMhgKxrbKq61sWCPfyJCBgwdpiv246agIGlDhoAp-z3IFmHRqhMtUPX9ld9C8LCWl1a0NBWdxr9maWZtzVrdhFJR0IdeAfS7UJi1RSEp8?key=ohXEd0bonMVYOWE2WqpxGA

 

  • Get URl List by ID

Get the configuration of the given URL list ID.

AD_4nXfAxZWqSx5l_m3InY02dtjAe6hH-8iaMIQ-pk2kzSQeHHrab_3QouajucHdMTFsCCygczJH7bvIhBrzeQFa94kAmOQ0OBStRr_dOCGmQ4EclsZwK8MBe8YDU0kaCTnVWTj07fOn3PuA9mG0_tzAwg1NnL5b?key=ohXEd0bonMVYOWE2WqpxGA

 

  • Replace a URL List Configuration

Completely replace the configuration of the given URL list ID.

AD_4nXepIik5TS-67J8sfuNGcpxchbNKqMfEXLkKFiqCG9pRlSkkbNMGR8HrhAcEG_UH6_mRO2l9z2rL4RTjeHCbEW3wLy8Xfyb6Zrlcd-1YF2nGs_2BRjKHnfzMU6fJ_YyQKb2H71xTWSQy9bLVwjk1DH7EC6Q?key=ohXEd0bonMVYOWE2WqpxGA

 

  • Patch URL List

Update name, URLs, and/or type of URL list object.

 

AD_4nXcRDgPee9t5CpsiN9QlwZ6Cj0o76tNq99QFpEMypEY1HPdCle6pQZWcY7ZwU-Scph9_E5KxKMsxO3XzsD-Ap1z_ZI_J3FvY15k5MfwssGoFB9kAs1KdhbtI-25wBoN7Jw3Sd3ph2iPa7_xEEcXlUNXw3B7r?key=ohXEd0bonMVYOWE2WqpxGA

 

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'.