Open ResultWindow based on full fileNames

Started by ben, August 05, 2017, 12:18:46 AM

Previous topic - Next topic

ben

Hi everyone,

i would like to open a resultWindow and show some files.
I use the endpoint '/v1/imatch/resultwindow/open'

As far as i understand the endpoint, i need the ids to each file.
But i have only the filenames (full path) for each file and not the ids. Those are read from an external file.

How can i find out the ids to each fileName (full path)?

Thanks for any hints,
Ben

Mario

You can use a path argument with the /files endpoint.
If you request the id in fields, this will give you the id of the file.

But there is a special endpoint /files/lookup which has been added to quickly lookup files with path in the database. This is used by import plug-ins or the File Finder app.
You can in an array of fully qualified path names and you get back the matching file ids.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben

I tried the /v1/files/lookup endpoint but it returns an error.

Do you use this endpoint yourself?
Might there be a bug or am i doing something wrong?


Python code for post(), which is a copy of all my other iMatch endpoint calls:
payload = {'type':'path', 'params':paramsList, 'auth_token':auth}
r = requests.get(HOST_URL + '/v1/files/lookup', params=payload, timeout=TIMEOUT)



Response of the POST request as plain text:

{
"error":{
  "code":1101,
  "message":"Unknown or unsupported method."
}
}HTTP/1.1 404 Not Found
Cache-Control: no-cache, no-store, must-revalidate, private, max-age=0
Pragma: no-cache
Expires: 0
Content-Type: text/plain; charset=utf-8
Date: Sun, 06 Aug 2017 20:42:03 GMT
Connection: close

Error 404: Not Found
Not found



Ben

Mario

This is a POST request. You use a GET request. Cannot work.

The /lookip is used e.g. in the the CSV Import module to quickly find large sets of files by name.
This is the reason why it is a POST. A POST body has virtually not length limit.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben