1

Searching units that contain an asterisk in their name

Тема: Searching units that contain an asterisk in their name

Good afternoon, i wanted to see if you could help me with something i can't figure it out yet.

Im trying to make a search for a unit by it's name, i used the API "core_search_items" and it works really good, the problem or my setback its when im trying to search a unit that has an asterisk in it's name like "Unit-24**" and since i have another unit called just "Unit-24" the API shows me that unit first and at the bottom the one with asterisks.
Also when i try to show the Unit info through php API the same case, just shows me the one without the asterisks and nothing else.

Is there a way for the API to recognize the asterisks and not "skip" them.

Here's an example of how i do it:

"hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&params={"spec":{"itemsType":"avl_unit","propName":"sys_name","propValueMask":"*Truck-80***","sortType":"sys_name"},"force":1,"flags":1439,"from":0,"to":0}&sid="my sid"

The unit name needs to be encapsulated by 2 asterisks in order to be read

Thank you, and any help is appreciated.

2

Searching units that contain an asterisk in their name

Re: Searching units that contain an asterisk in their name

jornadadgps22 пишет:

Good afternoon, i wanted to see if you could help me with something i can't figure it out yet.

Im trying to make a search for a unit by it's name, i used the API "core_search_items" and it works really good, the problem or my setback its when im trying to search a unit that has an asterisk in it's name like "Unit-24**" and since i have another unit called just "Unit-24" the API shows me that unit first and at the bottom the one with asterisks.
Also when i try to show the Unit info through php API the same case, just shows me the one without the asterisks and nothing else.

Is there a way for the API to recognize the asterisks and not "skip" them.

Here's an example of how i do it:

"hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&params={"spec":{"itemsType":"avl_unit","propName":"sys_name","propValueMask":"*Truck-80***","sortType":"sys_name"},"force":1,"flags":1439,"from":0,"to":0}&sid="my sid"

The unit name needs to be encapsulated by 2 asterisks in order to be read

Thank you, and any help is appreciated.


Hello. Asterisk is determined as a special symbol and replaces all not indicated symbols that can be included in the items' names.
In your specific case, you can try to use question mark. for example: "propValueMask":"Unit-24??"
One question mark replaces only 1 symbol - so the system will search for the unit with this name +2 symbol in the end.

As for the PHP code, unfortunately, I'm not familiar with it, but maybe special symbols should be encoded.
For example, if you send HTTP API requests, you need to use URL encode for special symbols like + or % -- https://www.url-encode-decode.com/

Anton Zinovyev
Technical Care Engineer (L2)
Wialon