Chilkat Online Tools

Swift3 / PrestaShop Webservice Demo Resource / Get all articles

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.basicAuth = true
    http.login = "{{webservice_key}}"
    http.password = "password"

    let sbResponseBody = CkoStringBuilder()!
    success = http.quickGetSb("https://localhost:8080/api/articles", sbContent: sbResponseBody)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("Response status code = \(http.lastStatus.intValue)")
    print("\(sbResponseBody.getAsString()!)")

}

Curl Command

curl -X GET
	-u '{{webservice_key}}:password'
https://localhost:8080/api/articles

Postman Collection Item JSON

{
  "name": "Get all articles",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{webservice_url}}/api/articles",
      "host": [
        "{{webservice_url}}"
      ],
      "path": [
        "api",
        "articles"
      ]
    }
  },
  "response": [
  ]
}