Chilkat Online Tools

PureBasic / PrestaShop Webservice Demo Resource / Get article blank schema

Back to Collection Items

IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"

Procedure ChilkatExample()

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

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success.i

    CkHttp::setCkBasicAuth(http, 1)
    CkHttp::setCkLogin(http, "{{webservice_key}}")
    CkHttp::setCkPassword(http, "password")

    queryParams.i = CkJsonObject::ckCreate()
    If queryParams.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkJsonObject::ckUpdateString(queryParams,"schema","blank")

    resp.i = CkHttp::ckQuickRequestParams(http,"GET","https://localhost:8080/api/articles",queryParams)
    If CkHttp::ckLastMethodSuccess(http) = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkJsonObject::ckDispose(queryParams)
        ProcedureReturn
    EndIf

    Debug Str(CkHttpResponse::ckStatusCode(resp))
    Debug CkHttpResponse::ckBodyStr(resp)
    CkHttpResponse::ckDispose(resp)



    CkHttp::ckDispose(http)
    CkJsonObject::ckDispose(queryParams)


    ProcedureReturn
EndProcedure

Curl Command

curl -G -d "schema=blank"
	-u '{{webservice_key}}:password'
https://localhost:8080/api/articles

Postman Collection Item JSON

{
  "name": "Get article blank schema",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{webservice_url}}/api/articles?schema=blank",
      "host": [
        "{{webservice_url}}"
      ],
      "path": [
        "api",
        "articles"
      ],
      "query": [
        {
          "key": "schema",
          "value": "blank"
        }
      ]
    }
  },
  "response": [
  ]
}