Chilkat Online Tools

Swift3 / MongoDB Atlas / Get Network Peering Containers in One Project by Cloud Provider

Back to Collection Items

func chilkatTest() {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()!
    var success: Bool

    http.digestAuth = true
    http.login = "username"
    http.password = "password"

    let queryParams = CkoJsonObject()!
    queryParams.update("providerName", value: "AWS")

    var resp: CkoHttpResponse? = http.quickRequestParams("GET", url: "https://domain.com/api/atlas/{{version}}/groups/{{ProjectID}}/containers", json: queryParams)
    if http.lastMethodSuccess == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("\(resp!.statusCode.intValue)")
    print("\(resp!.bodyStr!)")
    resp = nil

}

Curl Command

curl -G -d "providerName=AWS"
	--digest -u 'username:password'
https://domain.com/api/atlas/{{version}}/groups/{{ProjectID}}/containers

Postman Collection Item JSON

{
  "name": "Get Network Peering Containers in One Project by Cloud Provider",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{base_url}}/api/atlas/{{version}}/groups/{{ProjectID}}/containers?providerName=AWS",
      "host": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "atlas",
        "{{version}}",
        "groups",
        "{{ProjectID}}",
        "containers"
      ],
      "query": [
        {
          "key": "providerName",
          "value": "AWS"
        }
      ]
    },
    "description": "https://docs.atlas.mongodb.com/reference/api/vpc-get-containers-list/"
  },
  "response": [
  ]
}