Chilkat Online Tools

Swift3 / PrestaShop Webservice Product Resource / Get product

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/products/1", 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/products/1

Postman Collection Item JSON

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