'/v1/categories' and category with comma in name

Started by photokal, January 17, 2021, 10:13:57 PM

Previous topic - Next topic

photokal

Hi, Mario.

I'm working on a small project for my uses where I'm trying get some category information from IMatch into an external program. Everything is going well, but ran into one issue.

I'm having trouble returning category information (id,name,description) using IMWS (from the same machine as IMatch) for a category that has a comma (,) in the name. I have a category with the following path: Shows|Trips|UK -2017|Liverpool|Best of Liverpool, Pt I - 2017-05

I send this GET URL: http://127.0.0.1:50519/v1/categories?auth_token=(MY_AUTH_TOKEN)&path=Shows%7CTrips%7CUK%20%2D2017%7CLiverpool%7CBest%20of%20Liverpool%2C%20Pt%20I%20%2D%202017%2D05&fields=id,name,description

As you see, I've %encoded the comma (%2C), but no data are returned.

If I remove the comma from the category name and send:

http://127.0.0.1:50519/v1/categories?auth_token=(MY_AUTH_TOKEN)&path=Shows%7CTrips%7CUK%20%2D2017%7CLiverpool%7CBest%20of%20Liverpool%20Pt%20I%20%2D%202017%2D05&fields=id,name,description

I get the expected data returned.

As far as I can tell the URL is correctly encoded and, I would think, should return my category information.

It's not a big deal, as I can certainly refrain from using the comma in the category name, but I wanted to post this in case either

  • I need to do something else. If I've missed something in the documentation, please let me know where/what.
  • Might it be an issue? I doubt it, but just in case.

If I can provide any additional data to help on this, please let me know.

Thanks for your help and all your hard work.

--Alexander


Mario

Don't use , in category names. , is used to separate category names (or ids) when requesting them.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

photokal

Well, yes, I can/will do that.

I thought I had read that encoded commas in the URI should be interpreted as data while the un-encoded comma was used as a sub-component delimiter. But I guess that is dependent on the services, so certainly understand.

Not a problem; will avoid in new categories.

Thanks, again and stay well!

--Alexander

Mario

The server sees the un-encoded URL only. It them splits the "name" parameter using the separator (,) to get the individual category names. Which fails, if somebody actually uses , in category names. Which is rare.
Like with file names, it is usually better to keep category names simple. I know IMatch allows to use , in category names. But I should not. Well, too late to change that.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

thrinn

Well, the Web Services documentation for v1/categories says:
QuoteIf the category name contains a comma, it must be escaped with a tilde ~ => ~,

I could successfully retrieve my category TEST|Test, with comma this way:
http://127.0.0.1:50519/v1/categories?auth_token=&prettyprint=true&path=TEST%7cTest~,[/color]%20with%20comma
Thorsten
Win 10 / 64, IMatch 2018, IMA

Mario

Good point! :)
I don't recall all of these details. These APIs are several years old now. Gosh

Thank you for pointing this out. Much appreciated. Sunday night and all that  ;D
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

photokal

Excellent!

Thanks, Thorsten, for catching that. I knew I had missed something, even though I re-read the docs again. I just didn't connect it!  :-[

What!? Mario, you don't have every line of code committed to memory!?   ::)  But I knew there must be a way. You're just too good!
Speaking as a retired database programmer, I understand completely. I will, in future, read the docs again, again.

Just tested, and it worked like a charm.

You all have a great night!

Mario

Very good.

And no, I don't recall any detail of IMatch. Just too much of it.
As I often said, users will know more about specific things they use or tailored to their needs than I do. That's just how it is with a project like IMatch.
I refer to the IMatch help (which is extensive and quite good) often to refresh details about specific features.
My memory is good. But not that good. Especially at times like know, when I'm hip-deep into IMatch 2021 features. Awesome things coming up this year...

Quoteagain, again.

This remains me of a famous quote from one of my best concert experiences ever: "Again and again and again....". Let's see if somebody cares to figure it out.
Tip: Small town in Germany, flooded once a year by friendly music-loving people from all over the worlds. Pure awesome. And the band is from Finland. Many IMatch users from this beautiful country, too..
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook