Skip to content

Not possible to retrieve data from device using API #7645

Description

@MarkTerlien

Summary

The API requires a device name in lower case but device manufacturer provides device name in upper case. Using lower case device name in in API request does not return any data while upper case device name in API request results the following error:

{
      "error": {
            "code": 3,
            "message": "error:pkg/errors:validation (invalid end_device_ids: embedded message failed validation)",
            "details": [
                  {
                        "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
                        "namespace": "pkg/errors",
                        "name": "validation",
                        "message_format": "invalid {field}: {reason}",
                        "attributes": {
                              "field": "end_device_ids",
                              "name": "GetStoredApplicationUpRequestValidationError",
                              "reason": "embedded message failed validation"
                        },
                        "correlation_id": "6e43c71f588f49549cb8c3ecd73d630b",
                        "cause": {
                              "namespace": "pkg/errors",
                              "name": "validation",
                              "message_format": "invalid {field}: {reason}",
                              "attributes": {
                                    "field": "device_id",
                                    "name": "EndDeviceIdentifiersValidationError",
                                    "reason": "value does not match regex pattern "^a-z0-9{2,}$""
                              },
                              "correlation_id": "491804e4bebf4581b9ff0d420547396b",
                              "code": 3
                        },
                        "code": 3
                  }
            ]
      }
}

Is there a workaround?

Steps to Reproduce

  1. Make an application in The Things Stack
  2. Register a device in The Things Stack
  3. Add API key in The Things Stack
  4. Run following Python script:
# Import libraries
import requests 

# Aurorisatie
AUTORISATIE = '<your api key>'
APPLICATION = '<your application>'
DEVICE_ID = '<your device id>'

# HTTP headers
headers = {
    'Accept': 'application/json',
    'Authorization': 'bearer ' + AUTORISATIE,
    "User-Agent": "curl/7.61.0" 
}

# Opstellen URL
url = 'https://eu1.cloud.thethings.network/api/v3/as/applications/' + APPLICATION + '/devices/' + DEVICE_ID + '/packages/storage/uplink_message'

# Uitvoeren HTTP request
response = requests.get(url, headers=headers)
print(response)

Current Result

{
      "error": {
            "code": 3,
            "message": "error:pkg/errors:validation (invalid end_device_ids: embedded message failed validation)",
            "details": [
                  {
                        "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
                        "namespace": "pkg/errors",
                        "name": "validation",
                        "message_format": "invalid {field}: {reason}",
                        "attributes": {
                              "field": "end_device_ids",
                              "name": "GetStoredApplicationUpRequestValidationError",
                              "reason": "embedded message failed validation"
                        },
                        "correlation_id": "6e43c71f588f49549cb8c3ecd73d630b",
                        "cause": {
                              "namespace": "pkg/errors",
                              "name": "validation",
                              "message_format": "invalid {field}: {reason}",
                              "attributes": {
                                    "field": "device_id",
                                    "name": "EndDeviceIdentifiersValidationError",
                                    "reason": "value does not match regex pattern "^a-z0-9{2,}$""
                              },
                              "correlation_id": "491804e4bebf4581b9ff0d420547396b",
                              "code": 3
                        },
                        "code": 3
                  }
            ]
      }
}

Expected Result

Data from sensor

Relevant Logs

URL

No response

Deployment

The Things Stack Enterprise (self-hosted)

The Things Stack Version

No response

Client Name and Version

Other Information

No response

Proposed Fix

No response

Contributing

  • I can help by doing more research.
  • I can help by implementing a fix after the proposal above is approved.
  • I can help by testing the fix before it's released.

Validation

Code of Conduct

Activity

  1. KrishnaIyer commented on Jun 10, 2025

    @KrishnaIyer
    Member
    "field": "device_id"
    

    The device identifier and device name are two different fields. The former is a unique value with strict requirements (as you see here) and the device name is a general text value.
    I think the issue here is that you are using the name to query device where you need to use the device ID.

  2. added
    needs/detailsThis is missing some details
    and removed
    needs/triageWe still need to triage this
    on Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs/detailsThis is missing some details

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions