eDocs - Rest API - "Lookup" questions

Options
Laubstein
edited November 23, 2021 in eDOCS #1

Hi,

1 - In the following endpoint I known that the profile parameter is the name of the form but what is the key parameter and where I can look for it?


2 - Is there how to known the total entries of a lookup table?


3 - How can I use the filter query parameter to seach for more than one field with an or clause? For example I want to be able to search for all the fields below.



Thanks

Tagged:

Comments

  • 1) Lookups are related to the fields on forms so the first thing you'll need to do is examine the form definition (profile) for the specific lookup field using:

    GET .../edocsapi/v1.0/forms/<formname>/profile?library=<library>

    Example of the definition for the CLIENT_ID field found on the LEGALPROF form:

    Here you'll find CLIENT (lookup) is the name of the table and CLIENT_ID (name) is the key

    Making your lookup request look like this:

    GET .../edocsapi/v1.0/lookups/CLIENT?library=<library>&profile=<formname>&key=CLIENT_ID



    2) The reply will contain set information about the list of items returned and there you will find the total number of items available.



    3) Use the standard start, max and filter parameters to return only a subset of the total items

    To limit the items returned based on certain criteria then you would use the filter parameter.

    Example to only return the MATTER_IDs that pertain to a specific CLIENT_ID

    filter=CLIENT_ID=<id>

  • 4 - How can I use the start and max parameters? It seems that the api is ignoring the start parameter as you can see in the images below.

    The ascending or descending parameter seems to be ignored too.

    Am I using it right?


    Thanks

  • About question 3 - I don't think it's possible to filter more than one field Am I right? Even DM Explorer has a combobox for the user to choose which field they want to use for the search.

  • About question 2 - The total is the number of returned results, the cap is 250 in my tests when I do not filter anything, I was talking about the total records in the table.

  • The lookup retrievals will always start with the first record but can be set to less than the system default by using the max parameter.


    Multiple fields can be used in the filter parameter. filter=CLIENT_ID=<value> and MATTER_ID=<value>

  • Thanks, I'm thinking that if start doesn't skip rows, I don't think I'll be able to do server pagination properly.

    Do you have any tips to give me?

  • The number of records in the actual table is not available through the REST API only the number of items that are available because of either system limits or permissions.

  • Lookups are for finding something quickly so I would suggest using filters to show subsets of what could be a very large list.

    For example you may have a user base of over a thousand users and your trying to locate someone with a name that starts with 'N'. You could add filter=AUTHOR_ID=N* or FULL_NAME=N* to only return records of the users who's user id and/or name start with 'N'. This could be extended further to include the first couple of letters.

  • Thank you, I am dynamically building a form for an upload, I have to present all the necessary fields and if they have a lookup, the user can search for the record in a modal, in this modal he will have an input to search, such as the maximum of records is always 250 I will no longer do the paging on the server.


    When I try to filter 2 fields with an or in between like your last comment I am getting the error below, It works with an and.


    Seems like a parse error, any idea?


    Thanks!

  • Maybe the or means it is one or the other haha!

  • Try URL encoding the individual parameter values

    filter=AUTHOR_ID=N* or FULL_NAME=N*

    would become

    filter=AUTHOR_ID%3DN%2A%20or%20FULL_NAME%3DN%2A

  • Laubstein
    edited August 5, 2021 #13
    Options

    With enconding (CLIENTE_NOME_X=O* or PART_CONT_NOME_X=P*)

    Even without the * (CLIENTE_NOME_X=O or PART_CONT_NOME_X=P)

    Api version:

    "SERVER_INFO": {

          "CODE_REVISION": "32",

          "VERSION": "16.3.0",

          "NAME": "OpenText eDOCS REST API Server",

          "BUILD": "001"

        },

    I have tried enconding without * too

    CLIENTE_NOME_X=O or PART_CONT_NOME_X=P => CLIENTE_NOME_X%3DO%20or%20PART_CONT_NOME_X%3DP


    Response:

    Traceback (most recent call last):

     File "edocs\web\server.py", line 267, in HandleGETRequest

     File "edocs\controllers\lookups.py", line 30, in Get

     File "edocs\apihandlers\lookups.py", line 302, in GetId

     File "edocs\apihandlers\default.py", line 704, in AddUserFilterCriteria

    TypeError: unicode string expected instead of list instance

  • The ability to execute an "or" was introduced in a later version of the REST API. Try just sending one of the fields

  • Laubstein
    edited August 5, 2021 #15
    Options

    Thanks Al,

    Is there a way to execute an "or" using the DM COM API?

    I am looking at the PCDLookup and the PCDPropertyList, AddSearchCriteria and SetSearchCriteria methods and I am not sure how to achieve it.

    edocsdm16.4dmapi(x64)

  • I am thinking that I need to do the search multiple times for each field and do a reduce by the primary key, far from the best choice.

  • Al Slapsys
    Options

    Multiple calls and merging results is basically what the REST API does