iotcreators.com web
    • Login
    • Search
    • forum.iotcreators.com
    • docs.iotcreators.com
    • Tags
    • Popular
    • Recent
    • Register

    API access does not work

    iotcreators.com portal & API
    nb-iot mqtt api at command
    2
    3
    74
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      paulvha last edited by Aleksandra Klinkner

      I am trying to access my device with the API. I have tried many different commands with curl PUT and GET and different URL options advised in other posts and but it keeps failing with:{ “msg”: “Unauthorized”,“code”:1001}

      Let use the following command : curl -X GET ‘https://iot.netwerk.t-mobile.nl/m2m/subscriptions?type=resources&groupName=CON_000000XXXX’ -H ‘Authorization: Basic XXXXX0NPTl8wMDAwMDAxNDY1X2EzMThiOkUyM2dVKzM0S0AmYVJlXXX’

      The groupName is correct (changed for this posting)
      The authorization string (base64 username: password) is correct. I have double-checked that by entering this on another side on the internet to decode and that resulted in the correct username: password (changed for this posting).

      Somewhere I saw that you need to create the device first through the API instead of using the web-pages. Is that why it would not work or what am I doing wrong?

      regards,
      Paul

      1 Reply Last reply Reply Quote 0
      • Roland Baldin
        Roland Baldin iotcreators.com team last edited by

        @paulvha This URL and headers work for me:

        To get the list of all devices:
        URL:
        GET https://iot.netwerk.t-mobile.nl:443/rest/device?iDisplayLength=-1

        Headers:
        Content-Type:application/json
        Authorization:Basic base64(<USERNAME>:<PASSWORD>)
        Accept:application/json

        This should work with your credentials:
        curl -X GET https://iot.netwerk.t-mobile.nl:443/rest/device?iDisplayLength=-1 -H 'Authorization:Basic base(<USERNAME>:<PASSWORD>)

        As you can see the request works also without Content-Type and Accept.

        To get the details of a single device:
        URL:
        GET https://iot.netwerk.t-mobile.nl:443/rest/device/<ID>

        Headers:
        Content-Type:application/json
        Authorization:Basic base64(USERNAME:PASSWORD)
        Accept:application/json

        To get the details of the device don’t use the deviceId!

        Regards, Roland

        1 Reply Last reply Reply Quote 1
        • P
          paulvha last edited by

          Thansk Roalnd. Sorry for the delay… had another project. This works for me as well and now I can continue.

          regards,
          Paul

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post