/categories/refresh question

Started by ben, February 09, 2022, 09:33:57 PM

Previous topic - Next topic

ben

Hello everyone,

i am trying to update a category and its children by using the endpoint /v1/categories/refresh.
Unfortunately it doesn't refresh the children.

I tried to use "path" and also "regexp" parameter to define which category to update, but it seems i am not doing it right.
My category hierarchy looks as follows.
piview_data |
      dates |
         t-00
         t-01
         ..
         t-14


piview_data and dates are regular categories. Whereas t-00, t-01, ..., t-14 are data driven categories (automatic update is off).

I want to update all children t-00, t-01, ..., t-14
How should i correctly define the path?



Thanks  a lot
Ben

Mario

'piview_data|dates|t-00' should work.
What does IMWS respond to your request?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben

The response is:
{"result":"ok"}

I tried different combinations again and it seems to work.
I had some files that had problematic metadata and the write back didn't work.
Maybe this was the reason why the category was signaling still "this datadriven category needs to be refreshed".

Anyways, thanks for the help.

Ben

ben

I did some further tests since i wasn't sure about my results i got (/v1/categories/refresh):
Would be nice if you could have a look on my questions.


'path':"piview_data|dates
Reaction: no update
Return:  {"result":"ok"}
Q1: This doesn't update the children. Is this expected?


'path':"piview_data|dates|t-"
Reaction: no update
Return: {"result":"ok"}
Q2: Shouldn't this return "NOK", since the category "t-" doesn't exist?


'path':"piview_data|dates|t-00"
Reaction: update "t-00" but not the other children
Return: {"result":"ok"}
Q3: No question, reaction as expected


'regexp':"path,piview_data|dates|t-"
Reaction: updates all children "t-xx"
Return: {"result":"ok"}
Q4: Am i using the "regxep" parameter correctly?

Thanks a lot
Ben

thrinn

Quote from: ben on February 10, 2022, 10:43:46 PM
'regexp':"path,piview_data|dates|t-"
Reaction: updates all children "t-xx"
Return: {"result":"ok"}
Q4: Am i using the "regxep" parameter correctly?
I don't know about the endpoint, but from a RegExp perspective I guess you should escape the "|" because it is a special character. My guess is that your regexp would also update something like:
TEST|whatever|t-
because at least "t-" is part of the path.
Thorsten
Win 10 / 64, IMatch 2018, IMA

Mario

| has a special meaning in regular expressions and must be escaped with \
Since \ has a special meaning in JavaScript strings, it must be escaped as \\ => \\|
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben

I am using the regexp now, and escaping as "\\|".
This works, thanks thrinn and Mario.


What is left:
In case i provide a category that doesn't exist, the result of the endpoint is still {"result":"ok"}
Wouldn't we expect "nok" for both cases?
  'regexp':"path,piview_data\\|dates\\|t--"
  'path':"piview_data|dates|t--"




Ben

Mario

This endpoint hands over the refresh to a background processing task queue. The category is then refreshed at some later time.
It does not know if the category exists or not. So, always "ok" unless parameters are missing etc.

If this is an issue, get the category you plan to update so you know if it exists or not.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben

Thanks for clarification.
Now, i understand and can find a working solution for me.

Thanks
Ben