Allow an IP Address using the New API version

Allowing IP addresses lets users of an account log in only from certain (IPv4 or IPv6) addresses.

Note

Send an email request to help@qubole.com to enable allowing IP addresses for an account. Once enabled, users of the account can log in only from an allowed address.

Required Role

To make this API call you must:

  • Belong to the system-user or system-admin group.
  • Belong to a group associated with a role that allows editing an account. See Managing Groups and Managing Roles for more information.

Add an Allowed IP Address

POST /api/v2/accounts/whitelist_ip

Parameter

Parameter Description
ip_cidr IP address to be allowed, in IPv4 or IPv6 format.

Example

Request:

curl -X POST -H "X-AUTH-TOKEN: $X_AUTH_TOKEN" -H "Content-Type:application/json" -H "Accept: application/json" \
-d '{"ip_cidr" : "103.252.24.87"}' \ "https://gcp.qubole.com/api/v2/accounts/whitelist_ip"

Response:

{"status":{"status_code":200,"message":"IP whitelisted successfully."}}

List Allowed IP Addresses

GET /api/v2/accounts/whitelist_ip

Example

Request:

curl -X GET -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type:application/json" -H "Accept: application/json" \
"https://gcp.qubole.com/api/v2/accounts/whitelist_ip"

Response:

An array of hashes containing account ID and IP address info; for example:

{"account_whitelisted_ips":[{"account_id":1,"created_at":"2017-01-17T19:06:56Z","id":1,"ip_cidr":"103.252.24.92","updated_at":"2017-01-17T19:06:56Z"},{"account_id":1,"created_at":"2017-01-17T19:07:20Z","id":2,"ip_cidr":"103.252.24.91","updated_at":"2017-01-17T19:07:20Z"}]}

Delete One or More Allowed IP Addresses

DELETE /api/v2/accounts/whitelist_ip/<id>

where <id> is the ID of the allowed IP address. To delete multiple addresses, use a comma-separated list of IDs.

Example

Request:

curl -X DELETE -H "X-AUTH-TOKEN:  $X_AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
"https://gcp.qubole.com/api/v2/accounts/whitelist_ip/1,2"

Response

{"status":{"status_code":200,"message":"Deleted"}}