Chilkat Online Tools

autoit / PrestaShop Webservice Demo Resource / Get article (as JSON)

Back to Collection Items

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oHttp.BasicAuth = True
$oHttp.Login = "{{webservice_key}}"
$oHttp.Password = "password"

$oQueryParams = ObjCreate("Chilkat_9_5_0.JsonObject")
$oQueryParams.UpdateString("io_format","JSON")

Local $oResp = $oHttp.QuickRequestParams("GET","https://localhost:8080/api/articles/1",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)

Curl Command

curl -G -d "io_format=JSON"
	-u '{{webservice_key}}:password'
https://localhost:8080/api/articles/1

Postman Collection Item JSON

{
  "name": "Get article (as JSON)",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{webservice_url}}/api/articles/{{articleId}}?io_format=JSON",
      "host": [
        "{{webservice_url}}"
      ],
      "path": [
        "api",
        "articles",
        "{{articleId}}"
      ],
      "query": [
        {
          "key": "io_format",
          "value": "JSON"
        }
      ]
    }
  },
  "response": [
  ]
}