- API >
- MMS Public API >
- Whitelist
Whitelist¶
On this page
The resource modification operations POST
and DELETE
are whitelisted.
For example, you can only add an IP address to a whitelist if the request
originates from an IP address on the existing whitelist.
Sample Entity¶
Entity Fields¶
Name | Type | Description |
---|---|---|
ipAddress | string | A whitelisted IP address. |
created | date | The date this IP address was added to the whitelist. |
lastUsed | date | The date of the most recent request that originated from this IP address. Note that this field is only updated when a resource that is protected by the whitelist is accessed. |
count | integer | The total number of requests that originated from this IP address. Note that this field is only updated when a resource that is protected by the whitelist is accessed. |
Links¶
Relation | Description |
---|---|
self | Me |
user | The user that owns this whitelist. |
Operations¶
GET /api/public/v1.0/users/USER-ID/whitelist
- Gets the whitelist for the specified user. You can only access your own whitelist, so theUSER-ID
in the URL must match the ID of the user associated with the API Key.GET /api/public/v1.0/users/USER-ID/whitelist/IP-ADDRESS
- Gets the whitelist entry for a single IP address.POST /api/public/v1.0/users/USER-ID/whitelist
- Add one or more IP addresses to the user’s whitelist.- The entity body must be an array of whitelist entities, even if there is
only one. The only field you need to specify for each entity is the
ipAddress
. - If an IP address is already in the whitelist, it will be ignored.
- The entity body must be an array of whitelist entities, even if there is
only one. The only field you need to specify for each entity is the
DELETE /api/public/v1.0/users/USER-ID/whitelist/IP-ADDRESS
- Remove an IP address from the whitelist.- You cannot remove your current IP address from the whitelist.
Examples¶
Get a user’s whilelist:
curl -i -u "username:apiKey" --digest "https://mms.mongodb.com/api/public/v1.0/users/5356823b3004dee37132bb7b/whitelist"
HTTP/1.1 200 OK
{
"totalCount" : 1,
"results" : [ {
"ipAddress" : "12.34.56.78",
"created" : "2014-04-23T16:17:44Z",
"count" : 482,
"links" : [ ... ]
} ],
"links" : [ ... ]
}
Get a single whitelist entry:
curl -i -u "username:apiKey" --digest "https://mms.mongodb.com/api/public/v1.0/users/5356823b3004dee37132bb7b/whitelist/12.34.56.78"
HTTP/1.1 200 OK
{
"ipAddress" : "12.34.56.78",
"created" : "2014-04-23T16:17:44Z",
"count" : 482,
"links" : [ ... ]
}
Add entries to a user’s whitelist:
curl -i -u "username:apiKey" --digest "https://mms.mongodb.com/api/public/v1.0/users/5356823b3004dee37132bb7b/whitelist" -X POST -H "Content-Type: application/json" --data @-
[ {
"ipAddress" : "76.54.32.10"
}, {
"ipAddress" : "2.3.4.5"
} ]
HTTP/1.1 201 Created
Location: https://mms.mongodb.com/api/public/v1.0/users/5356823b3004dee37132bb7b/whitelist
{
"totalCount" : 3,
"results" : [ {
"ipAddress" : "12.34.56.78",
"created" : "2014-04-23T16:17:44Z",
"count" : 0,
"links" : [ ... ]
}, {
"ipAddress" : "76.54.32.10",
"created" : "2014-04-23T16:23:44Z",
"count" : 0,
"links" : [ ... ]
}, {
"ipAddress" : "2.3.4.5",
"created" : "2014-04-23T16:23:44Z",
"count" : 0,
"links" : [ ... ]
} ],
"links" : [ ... ]
}
Delete an entry from a user’s whitelist:
curl -i -u "username:apiKey" --digest "https://mms.mongodb.com/api/public/v1.0/users/5356823b3004dee37132bb7b/whitelist/2.3.4.5" -X DELETE
HTTP/1.1 200 OK