Cannot add a new Cloud SWG location using documented APIs
search cancel

Cannot add a new Cloud SWG location using documented APIs

book

Article ID: 263521

calendar_today

Updated On:

Products

Cloud Secure Web Gateway - Cloud SWG

Issue/Introduction

Cloud SWG admin needs to create a number of new connectivity locations.

Admin prefers to do it automatically using documented SWG location APIs than using the manual approach using the Cloud SWG Portal. 

Cloud SWG API location docs include examples for IPSEC locations, but none from Explicit locations.

Executing the following option to add a new TestLocation using the API failed with a 400 error:

curl -k -X POST -u x:x "https://portal.threatpulse.com/api/locations?name=TestLocation&ip=166.66.66.66&type=ExplicitProxy&agentActive=true&selectiveIntercept=true" 

The html response provided some important information to resolve the request error:

<h1>HTTP Status 400 - Unknown Location and type is not provided</h1>

Environment

Cloud SWG APIs.

Cause

The request was setup with an invalid type parameter.

Resolution

In order for the request to work as expected the type has to be set to "explicit-proxy" and not ExplicitProxy as shown below:

curl -k -X POST -u x:x "https://portal.threatpulse.com/api/locations?name=TestLocation&ip=166.66.66.66&type=explicit-proxy&agentActive=true&selectiveIntercept=true"  

Once the type was corrected, the API request completed as needed and the location was created.