Sample code for 30+ languages & platforms
PureBasic

Bluzone Get List of Beacons

See more Bluzone Examples

Get beacons for a project.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkHttp.pb"

Procedure ChilkatExample()

    success.i = 0

    ; 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

    ; Implements the following CURL command:

    ; curl -X GET \
    ;   https://bluzone.io/portal/papis/v1/projects/YOUR_PROJECT_ID_HERE/devices/beacons \
    ;   -H 'bzid: YOUR_API_KEY_HERE'

    CkHttp::ckSetRequestHeader(http,"bzid","YOUR_API_KEY_HERE")

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

    success = CkHttp::ckQuickGetSb(http,"https://bluzone.io/portal/papis/v1/projects/YOUR_PROJECT_ID_HERE/devices/beacons",sbResponseBody)
    If success = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkStringBuilder::ckDispose(sbResponseBody)
        ProcedureReturn
    EndIf

    Debug "Response body:"
    Debug CkStringBuilder::ckGetAsString(sbResponseBody)


    CkHttp::ckDispose(http)
    CkStringBuilder::ckDispose(sbResponseBody)


    ProcedureReturn
EndProcedure