Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
protogrid:json_api_database_views [2017-12-15 15:25] – sbl | protogrid:json_api_database_views [2022-05-14 00:48] – [Views for Deleted Cards] dru | ||
---|---|---|---|
Line 3: | Line 3: | ||
A Database View can be seen as a table with two columns. The first column is called ' | A Database View can be seen as a table with two columns. The first column is called ' | ||
- | < | + | < |
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 14: | Line 13: | ||
" | " | ||
], | ], | ||
- | " | ||
" | " | ||
}, | }, | ||
Line 22: | Line 20: | ||
" | " | ||
], | ], | ||
- | " | ||
" | " | ||
}, | }, | ||
Line 30: | Line 27: | ||
" | " | ||
], | ], | ||
- | " | ||
" | " | ||
} | } | ||
Line 40: | Line 36: | ||
For details about listings / views and how to request it, please see section about view [[protogrid: | For details about listings / views and how to request it, please see section about view [[protogrid: | ||
- | ===== all_by_id | + | For newcomers: In 90% of use cases, the [[# |
+ | |||
+ | ===== Protogrid Standard Views ===== | ||
+ | |||
+ | ==== Simple Overall Views ==== | ||
+ | |||
+ | === all_by_id | ||
This view basically lists all the ids of all the Cards. The row values are null (i.e. unused). The result is paged, which means that you might need several requests to load all the ids. To load the next page, you can use the " | This view basically lists all the ids of all the Cards. The row values are null (i.e. unused). The result is paged, which means that you might need several requests to load all the ids. To load the next page, you can use the " | ||
Line 49: | Line 51: | ||
Example respond: | Example respond: | ||
- | < | + | < |
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
- | | + | |
], | ], | ||
" | " | ||
- | | + | |
- | " | + | " |
- | " | + | " |
- | ], | + | ], |
- | " | + | " |
- | | + | |
}, | }, | ||
... | ... | ||
- | | + | |
- | } | + | |
} | } | ||
- | </ | ||
- | |||
- | ===== all_protos_by_id ===== | ||
- | This view contains all Protos by id. The value contains shortname and a list of design_elements. | ||
- | |||
- | Example request to get the first 5 protos: | ||
- | < | ||
- | https:// | ||
- | </ | ||
- | |||
- | Example respond: | ||
- | <code json> | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | ], | ||
- | " | ||
- | " | ||
- | } | ||
- | } | ||
- | }, | ||
- | ... | ||
- | ] | ||
- | } | ||
} | } | ||
</ | </ | ||
- | ===== by_id ===== | + | === by_id === |
This View contains all non-deleted and non-hidden Card IDs as keys. The value is null. This gives you fast access to all the Card IDs in your Application. This can be useful for example when doing some kind of synchronization and checking for new documents. | This View contains all non-deleted and non-hidden Card IDs as keys. The value is null. This gives you fast access to all the Card IDs in your Application. This can be useful for example when doing some kind of synchronization and checking for new documents. | ||
Line 125: | Line 78: | ||
https:// | https:// | ||
</ | </ | ||
+ | |||
+ | Please note that the " | ||
Example respond (be aware, that this Card is a System Card and therefore looks different to the typical Cards): | Example respond (be aware, that this Card is a System Card and therefore looks different to the typical Cards): | ||
- | < | + | < |
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 233: | Line 187: | ||
"&& | "&& | ||
], | ], | ||
- | " | ||
" | " | ||
}, | }, | ||
Line 242: | Line 195: | ||
</ | </ | ||
- | ===== by_id_and_value | + | ==== Overall Views With Filtering/ |
- | This view contains all non-deleted and non-hidden Cards. The value is raw Card. In typical use, you want to use this view to load your Cards, since you do not want to load Cards which are deleted or hidden by accident. | + | |
- | **Be aware**: This is one of the very few views, where the key is **NOT** surrounded by "[ ... ]"! | + | === by_sortstring_and_id === |
- | Example request to get the Cards whose ID is within | + | === by_design_element_and_sortstring_and_id === |
+ | |||
+ | === by_design_element_and_value_and_sortstring_and_id === | ||
+ | This view contains all non-deleted and non-hidden Cards by design_element, | ||
< | < | ||
- | https:// | + | ["234486c7-939f-49f4-88b2-6fd51369a1d9", "Basic Toilet 2016 ", "Basic Toilet 2016 ", " |
</ | </ | ||
+ | The value is null. | ||
- | Example | + | Example |
- | < | + | < |
+ | https:// | ||
+ | </ | ||
+ | |||
+ | Example response: | ||
+ | < | ||
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
{ | { | ||
- | " | + | " |
- | " | + | "816950eb-1b70-41e2-89f5-5400f9636345", |
- | " | + | "night knight PRO", |
- | "_id": " | + | "night knight PRO", |
- | "_rev": " | + | "9a5f37ab-30a7-4c91-b99f-f573a1c7d1b9" |
- | "denormalized": { | + | ], |
- | "&& | + | "value": |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | } | + | |
- | } | + | |
- | | + | |
- | " | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | } | + | |
- | ], | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | } | + | |
- | | + | |
- | "proto_key": | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | } | + | |
}, | }, | ||
{ | { | ||
- | " | + | " |
- | ... | + | |
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
} | } | ||
] | ] | ||
Line 334: | Line 242: | ||
</ | </ | ||
- | ===== deleted_by_id | + | ==== Proto Specific Views ==== |
- | This view contains the IDs of all the deleted Cards as keys. The value is null. The request and response are analog to view [[# | + | |
- | ===== by_proto_and_id ===== | + | === by_proto_and_sortstring_and_id |
- | This view contains all non-deleted and non-hidden Cards with corresponding Proto by id. The key is composed of the Proto key and the Card key. The value is null. This view can be used to get all Cards belonging to a special Proto given the Proto key. | + | This view contains all non-deleted and non-hidden Cards with corresponding Proto by id. The key is composed of the Proto key, the Card sorting string |
Example Request to get all Cards belonging to the Proto with key " | Example Request to get all Cards belonging to the Proto with key " | ||
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
Line 348: | Line 255: | ||
Example respond: | Example respond: | ||
- | < | + | < |
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 357: | Line 263: | ||
" | " | ||
" | " | ||
+ | "CWH ONE", | ||
" | " | ||
], | ], | ||
- | " | ||
" | " | ||
}, | }, | ||
Line 368: | Line 274: | ||
</ | </ | ||
- | Out of this, you now know the Card keys of all Cards based on this Proto. To get the content of the Cards, you need to get the second part of every key, read it into an array and the request all Cards within the array using the view [[# | + | === by_proto_and_design_element_and_sortstring_and_id === |
- | ===== by_proto_and_shortname_and_id ===== | + | === by_proto_and_design_element_and_value_and_sortstring_and_id |
- | This View contains all non-deleted and non-hidden Cards with corresponding | + | This view contains all non-deleted and non-hidden Cards by |
- | < | + | < |
- | ["12532072-0d76-4457-8cf8-7847d0470738", "SuperCleaner 2000 - washing machines", "89e74e40-b0ef-4bc3-8e89-a43a43763087"] | + | ["9c2bdd7d-05bd-4d16-8339-11116e737b3a", "&& |
</ | </ | ||
- | The value is null. | + | The value is null. You typically want to use this view to query on system fields such as "&& |
- | Since the Shortname may differ in different languages, there is one entry per selected language. This may also mean, that if the Shortname is the same for several languages, you get the result several times. | + | |
- | This allows | + | Example Request |
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
- | Example | + | Example |
- | < | + | < |
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
{ | { | ||
" | " | ||
- | "2843c3cf-abee-45a5-a869-e0ea9703c7c0", | + | "12532072-0d76-4457-8cf8-7847d0470738", |
- | "sewer cover", | + | "ed2c109d-a825-4b97-a0bb-31c13185408d", |
- | "f8f9f426-0d72-42bf-bd00-c9164d500334" | + | " |
+ | "CWH ONE - toilet", | ||
+ | "4bcbdb7f-89c3-4640-b04e-3bd468df7c57" | ||
], | ], | ||
- | " | ||
" | " | ||
}, | }, | ||
{ | { | ||
" | " | ||
- | "2843c3cf-abee-45a5-a869-e0ea9703c7c0", | + | "12532072-0d76-4457-8cf8-7847d0470738", |
- | "sewer cover", | + | "ed2c109d-a825-4b97-a0bb-31c13185408d", |
- | "f8f9f426-0d72-42bf-bd00-c9164d500334" | + | " |
+ | " | ||
+ | "e086c668-500b-4acf-982c-df4f3be65a6b" | ||
], | ], | ||
- | " | ||
" | " | ||
} | } | ||
Line 413: | Line 319: | ||
</ | </ | ||
- | ===== by_search_term_and_id | + | ==== Views for Deleted Cards ==== |
- | This view contains Cards for a certain | + | |
- | < | + | === deleted_by_sortstring_and_id |
- | ["behavior", "1475e62a-47d7-4a29-98c2-c89f50edd497"] | + | This view contains |
+ | |||
+ | === deleted_by_design_element_and_sortstring_and_id === | ||
+ | This view contains all deleted Cards sorted by a certain | ||
+ | |||
+ | === deleted_by_design_element_and_value_and_sortstring_and_id === | ||
+ | This view contains all deleted Cards by a certain Proto, design_element, | ||
+ | |||
+ | ==== Views for Navigation in Relational Tree (Up / Down) ==== | ||
+ | |||
+ | === related_keys_by_id === | ||
+ | This view contains | ||
+ | |||
+ | Example request to find all Cards related to the Card " | ||
+ | < | ||
+ | https:// | ||
+ | </ | ||
+ | |||
+ | Example | ||
+ | < | ||
+ | { | ||
+ | " | ||
+ | | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | "" | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | "" | ||
+ | ] | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | } | ||
</ | </ | ||
- | The value is null. | ||
- | **Be aware**: The search only goes over values stored in this Card. This may differ from the visual representation Card. For example when Card A references another Card, you see the Shortname | + | === relating_cards_by_related_key_and_id === |
+ | This view contains all Relating Cards of the (Related) Card specified by key. The key is composed of the Related | ||
- | Example request to find all cards containing | + | Example request to find all Cards relating to the (Related) Card with key "626f04f7-179d-40d7-99f0-9e54343abf98": |
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
Example response: | Example response: | ||
- | < | + | < |
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
- | ], | ||
" | " | ||
{ | { | ||
" | " | ||
- | "behavior", | + | "626f04f7-179d-40d7-99f0-9e54343abf98", |
- | "1475e62a-47d7-4a29-98c2-c89f50edd497" | + | "00ded64d-5e1b-42a1-a61e-f8e46c0c552a" |
], | ], | ||
- | " | ||
" | " | ||
}, | }, | ||
{ | { | ||
" | " | ||
- | "behavior", | + | "626f04f7-179d-40d7-99f0-9e54343abf98", |
- | "1475e62a-47d7-4a29-98c2-c89f50edd497" | + | "50a9098b-bd4e-47fe-9e99-7d8f1d43517a" |
], | ], | ||
- | " | ||
" | " | ||
}, | }, | ||
{ | { | ||
" | " | ||
- | "behavior", | + | "626f04f7-179d-40d7-99f0-9e54343abf98", |
- | "ba9859e1-68ad-4004-b8e0-c4f0812edf20" | + | "5d068708-9546-4536-94c6-da27b6a909b2" |
], | ], | ||
- | " | ||
" | " | ||
}, | }, | ||
- | | + | |
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | } | ||
] | ] | ||
} | } | ||
Line 468: | Line 448: | ||
</ | </ | ||
- | You might have duplicates in the code due to several occurrences of the same search term on the same Card. | + | ==== Views for Direct Human Readable Presentation ==== |
- | ===== deleted_by_search_term_and_id ===== | + | === tableview_data_by_id |
- | This view contains all deleted | + | This view contains all Cards contained in a tableview |
- | + | ||
- | ===== by_proto_and_search_term_and_id ===== | + | |
- | This view contains | + | |
- | < | + | |
- | [" | + | |
- | </ | + | |
- | Example | + | Example |
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
Example response: | Example response: | ||
- | < | + | < |
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
{ | { | ||
" | " | ||
- | "9c2bdd7d-05bd-4d16-8339-11116e737b3a", | + | "5f12ccf6-9de0-4796-d366-106e4b7b8af9" |
- | " | + | |
- | " | + | |
], | ], | ||
- | " | + | "value": |
- | "value": | + | "#": |
- | }, | + | " |
- | | + | ], |
+ | "&& | ||
+ | " | ||
+ | ], | ||
+ | "&& | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | "&& | ||
+ | " | ||
+ | ], | ||
+ | "&& | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | "&& | ||
+ | "&& | ||
+ | ], | ||
+ | "&& | ||
+ | { | ||
+ | | ||
+ | "en": | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | "" | ||
+ | ], | ||
+ | " | ||
+ | "" | ||
+ | ] | ||
+ | } | ||
+ | | ||
] | ] | ||
} | } | ||
Line 506: | Line 508: | ||
</ | </ | ||
- | ===== by_design_element_and_value_and_id ===== | + | === shortname_objects_by_id |
- | This view contains all non-deleted and non-hidden | + | This view contains all Cards which contain shortname data by id. The value contains |
- | < | + | |
- | [" | + | |
- | </ | + | |
- | The value is null. | + | |
- | Example request to get all Cards, where the name (in my example having | + | Example request to get the shortnames of the Card with key "a0e6717f-c613-404a-bc08-a090311c651c": |
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
- | Axample | + | Example |
- | < | + | < |
{ | { | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
{ | { | ||
" | " | ||
- | "816950eb-1b70-41e2-89f5-5400f9636345", | + | "a0e6717f-c613-404a-bc08-a090311c651c" |
- | "night knight PRO", | + | |
- | " | + | |
], | ], | ||
- | | + | " |
- | | + | "de": "Priscilla Molesworth |
- | }, | + | "en": "Priscilla Molesworth |
- | | + | |
- | "key": | + | |
- | | + | |
- | "nightTable 2.0", | + | |
- | " | + | |
- | ], | + | |
- | " | + | |
- | | + | |
} | } | ||
] | ] | ||
Line 548: | Line 536: | ||
</ | </ | ||
+ | ===== Views of Dedicated Search Dialog Boxes ===== | ||
+ | It is also possible to access the views of dedicated [[protogrid: | ||
- | ===== deleted_by_design_element_and_value_and_id===== | + | Hint: For straight forward API usage in most cases it is recommended |
- | This view contains all deleted Cards for a certain search term by design_element, | + | |
- | ===== by_proto_and_design_element_and_value_and_id ===== | + | Please note that Datetime Fields in Dedicated Search Boxes are indexed slightly differently than in normal views: If the date-time value is configured as a fixed filter field, the time component will always be set to 0 (example: "2021-11-11T00:00:00.000Z"). If the date-time value is configured |
- | This view contains all non-deleted and on-hidden Cards by Proto, design_element, | + | |
- | < | + | |
- | [" | + | |
- | </ | + | |
- | The value is null. You typically want to use this view to query on system fields such as "&& | + | |
- | $$$ Example Request | + | Example Request: |
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
- | $$$not yet working? | ||
- | |||
- | ===== relational_definitions_by_id_and_related_proto ===== | ||
- | All relational definitions by related proto and id. Value is null. | ||
- | |||
- | ===== data_protos_by_id ===== | ||
- | All data Protos by id. Value is null. | ||
- | |||
- | ===== data_protos_by_search_term_and_id ===== | ||
- | All data Protos for a certain search term and by id. Value is null. | ||
- | |||
- | ===== datetime_field_definitions_by_id ===== | ||
- | All datetime field definitions by id. | ||
- | |||
- | ===== datetime_field_definitions_by_search_term_and_id ===== | ||
- | All datetime field_definitions for a certain search term by id. Value is null. | ||
- | |||
- | ===== related_keys_by_id ===== | ||
- | All Cards with related keys by id. Value contains the related keys. | ||
- | |||
- | ===== by_relating_key ===== | ||
- | All Cards with the related key by id. Value is null. | ||
- | |||
- | ===== tableview_data_by_id ===== | ||
- | All Cards contained in a tableview by id. Value contains the raw card. | ||
- | |||
- | ===== shortname_by_language_objects_by_id ===== | ||
- | All Cards which contains shortname data by id. Value contains the shortnames by language. | ||
- | ===== sums_by_proto_and_design_element | + | The key depends on the individually configured Filter Fields |
- | Sums over the values of a field for all Cards of a Proto. Depending on the field type, this uses the following functions: | + | |
- | - For number fields it produces the sum of values over the field. | + | |
- | - For text fields it produces the word count over all text entries. | + | |
- | - For relation fields it produces the number of stored relations. | + | |
- | - For date/time fields it produces | + | |
- | ===== sums_by_proto_and_design_element_and_condition | + | ===== Change Log ===== |
- | Sums over the values of a field for all Cards of a Proto given a condition from another field. This key requires query keys with four components: | + | ==== Standard Views Decommissioned With Version 2.1.5 ==== |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | Example: What is the sum over all values in the “Total” field in the Proto “Invoice”, | + | * data_protos_by_search_term_and_id |
+ | * datetime_field_definitions_by_id | ||
+ | * datetime_field_definitions_by_search_term_and_id | ||
+ | * deleted_by_design_element_and_value_and_id | ||
+ | * deleted_by_id | ||
+ | * deleted_by_search_term_and_id | ||
+ | * logs_by_time_and_id | ||
+ | * navroot_candidates_by_design_element_and_value_and_id | ||
+ | * navroot_candidates_by_id | ||
+ | * navroot_candidates_by_search_term_and_id | ||
+ | * number_field_definitions_by_id | ||
+ | * number_field_definitions_by_search_term_and_id | ||
+ | * relational_definitions_by_id_and_related_proto | ||
+ | * text_field_definitions_by_id | ||
+ | * text_field_definitions_by_search_term_and_id | ||
- | Depending on the field type, this uses the following functions: | + | ==== Standard Views Decommissioned With Version 2.2.1 ==== |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
+ | * navroot_candidates_by_design_element_and_sortstring_and_id | ||
+ | * navroot_candidates_by_design_element_and_value_and_sortstring_and_id | ||
+ | * sums_by_proto_and_design_element | ||
+ | * sums_by_proto_and_design_element_and_condition | ||
+ | * datetime_field_definitions_by_sortstring_and_id | ||
+ | * datetime_field_definitions_by_search_term_and_sortstring_and_id | ||
+ | * text_field_definitions_by_sortstring_and_id | ||
+ | * text_field_definitions_by_search_term_and_sortstring_and_id | ||
+ | * number_field_definitions_by_sortstring_and_id | ||
+ | * number_field_definitions_by_search_term_and_sortstring_and_id | ||
+ | * all_protos_by_id | ||
+ | * all_agents_by_id | ||
+ | * all_connectors_by_url_name | ||
+ | ==== Adjustments to Views With Version 2.2.2 ==== | ||
+ | - All views: If a view is requested with the " | ||
+ | - All views: All string values as well as sortstrings are now cut off after 300 characters. | ||
+ | - All views: The separator between human readable values and keys is now " | ||
+ | - All views: The second last column " | ||
+ | - Dedicated Search Boxes: Now all filters must be set. An empty filter field in a Search Dialog Boxes now means a filter for those Cards where the target field is also empty. | ||
+ | - Dedicated Search Boxes: Datetime Fields in Dedicated Search Boxes are now indexed slightly differently than in normal views: If the date-time value is configured as a fixed filter field, the time component will always be set to 0 (example: “2021-11-11T00: | ||
+ | - Dedicated Search Boxes with " | ||
+ | * For Relation/ | ||
+ | * For other field values: "< | ||
+ | * Note: It is anyway recommended to use Search Dialog Boxes with display mode “Simple Keys in JSON API only” (i. e. non-sortable). | ||
+ | - In views " | ||
+ | * For Relation/ | ||
+ | * For other field values: "< | ||
+ | * Note: If you don't explicitly need sorting by design element value is anyway recommended to use the views " | ||
+ | - In views " | ||
+ | * View columns of " | ||
+ | * View columns of by_design_element_and_sortstring_and_id"" |