Discussions

Ask a Question
Back to all

Better alternatives to validate an Asset Tag ID exist

main issue

My application is accepting a Asset Tag ID and uses the query API to view the documents an asset has. However before making the call to view the docs I would like to check if the Asset Tag ID provided as a user input is valid and existing in Corrigo.

{
    "QueryExpression": {
        "Distinct": true,
        "PropertySet": {
            "Properties": [
                "Info.TagId"
            ]
        },        
        "Criteria": {
            "FilterOperator": "And",
            "Conditions": [
                {
                    "PropertyName": "Info.TagID",
                    "Operator": "Equal",
                    "Values": ["TAG ID"]  // TagID value to lookup asset
                }
            ]
        },
        "FirstResultIndex": 0,
        "Count": 10
    }
}

Presently I am using this to check the validity as it returns an empty response on an invalid asset tag ID. Let me know if there is a better way.


other questions

  • Is there a way to have a regex input validation on the Asset Tag ID before I can make the API call for existence check?
  • What could be the maximum length of the Tag ID?

Thanks