photools.com Community

IMatch Discussion Boards => IMatch Scripting and Apps => Topic started by: ben on August 05, 2017, 12:18:46 AM

Title: Open ResultWindow based on full fileNames
Post by: ben on August 05, 2017, 12:18:46 AM
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
Title: Re: Open ResultWindow based on full fileNames
Post by: Mario on August 05, 2017, 07:48:21 AM
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.
Title: Re: Open ResultWindow based on full fileNames
Post by: ben on August 06, 2017, 10:46:41 PM
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
Title: Re: Open ResultWindow based on full fileNames
Post by: Mario on August 07, 2017, 03:19:39 PM
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.
Title: Re: Open ResultWindow based on full fileNames
Post by: ben on August 08, 2017, 11:23:22 PM
Argh, stupid mistake.
Thanks.
Now it works