Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
protogrid:json_api_database_views [2021-09-15 17:59] – [data_protos_by_sortstring_and_id] druprotogrid:json_api_database_views [2023-01-10 23:16] (current) – [Standard Views Decommissioned With Version 2.6.0] dru
Line 3: Line 3:
 A Database View can be seen as a table with two columns. The first column is called 'key', the second one is called 'value'. The keys have to be unique. A lookup to a view always expects a key, several keys or a range of keys. The response of a lookup consists of all requested keys together with their values. Example for respond: A Database View can be seen as a table with two columns. The first column is called 'key', the second one is called 'value'. The keys have to be unique. A lookup to a view always expects a key, several keys or a range of keys. The response of a lookup consists of all requested keys together with their values. Example for respond:
  
-<code json>+<code javascript>
 { {
   "errors": [],   "errors": [],
-  "protogrid_environment_version": "1.4.10", 
   "result": {   "result": {
     "rows": [     "rows": [
Line 14: Line 13:
           "4bcbdb7f-89c3-4640-b04e-3bd468df7c57"           "4bcbdb7f-89c3-4640-b04e-3bd468df7c57"
         ],         ],
-        "shortname": "CWH ONE", 
         "value": null         "value": null
       },       },
Line 22: Line 20:
           "7e3e7a96-6ea7-4dc7-a58a-1c781ae35e7b"           "7e3e7a96-6ea7-4dc7-a58a-1c781ae35e7b"
         ],         ],
-        "shortname": "DirtKiller 64 -  washing machines", 
         "value": null         "value": null
       },       },
Line 30: Line 27:
           "89e74e40-b0ef-4bc3-8e89-a43a43763087"           "89e74e40-b0ef-4bc3-8e89-a43a43763087"
         ],         ],
-        "shortname": "SuperCleaner 2000 -  washing machines", 
         "value": null         "value": null
       }       }
Line 39: Line 35:
  
 For details about listings / views and how to request it, please see section about view [[protogrid:api_endpoints|endpoints]]. Please note that all views have the Card id as the last key component due to how Protogrid is implemented on top of CouchDB. In most cases it is useful to specify the start_key and end_key URL parameters with null and {} (empty object) as their last element. This will give all keys matching the other specified keys. For details about listings / views and how to request it, please see section about view [[protogrid:api_endpoints|endpoints]]. Please note that all views have the Card id as the last key component due to how Protogrid is implemented on top of CouchDB. In most cases it is useful to specify the start_key and end_key URL parameters with null and {} (empty object) as their last element. This will give all keys matching the other specified keys.
 +
 +For newcomers: In 90% of use cases, the [[#by_proto_and_design_element_and_value_and_sortstring_and_id|"by_proto_and_design_element_and_value_and_sortstring_and_id"]] view fits best.
  
 ===== Protogrid Standard Views ===== ===== Protogrid Standard Views =====
-==== all_by_id ====+ 
 +==== 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 "next_card_key" of the previous page as startkey. 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 "next_card_key" of the previous page as startkey.
  
Line 50: Line 51:
  
 Example respond: Example respond:
-<code json>+<code javascript >
 { {
   "errors": [],   "errors": [],
-  "protogrid_environment_version": "1.4.10", 
   "result": {   "result": {
     "next_card_key": [     "next_card_key": [
-    "51b97f49-3262-4339-a8c7-2e8166887761"+      "51b97f49-3262-4339-a8c7-2e8166887761"
     ],     ],
     "rows": [     "rows": [
-    +      
-      "key":+        "key":
-      "4d523d95-31dd-4cb3-b60a-c974404e4ffd" +          "4d523d95-31dd-4cb3-b60a-c974404e4ffd" 
-      ], +        ], 
-      "shortname": {}, +        "value": null
-      "value": null+
       },       },
       ...       ...
-      ] +    ]
-    }+
   }   }
 +}
 </code> </code>
    
-==== 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 83: Line 82:
  
 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):
-<code json>+<code javascript >
 { {
     "errors": [],     "errors": [],
-    "protogrid_environment_version": "1.4.14", 
     "result": {     "result": {
         "next_card_key": [         "next_card_key": [
Line 189: Line 187:
                     "&&adminMenuDefinition"                     "&&adminMenuDefinition"
                 ],                 ],
-                "shortname": "Menu:Administration", 
                 "value": null                 "value": null
             },             },
Line 198: Line 195:
 </code> </code>
  
-==== deleted_by_sortstring_and_id ==== +==== Overall Views With Filtering/Sorting ====
-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_id|"by_id"]].+
  
-==== by_proto_and_sortstring_and_id ==== +=== by_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, the Card sorting string 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.+
  
-Example Request to get all Cards belonging to the Proto with key "12532072-0d76-4457-8cf8-7847d0470738":+=== 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, date and id. Therefore the key is composed of the key of the design element, the value of the design element, the Card sorting string and the Card key. Example:
 <code> <code>
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_sortstring_and_id?start_key=["12532072-0d76-4457-8cf8-7847d0470738", null, null]&end_key=["12532072-0d76-4457-8cf8-7847d0470738", {}, {}] +["234486c7-939f-49f4-88b2-6fd51369a1d9", "Basic Toilet 2016 ", "Basic Toilet 2016 ", "d81047c2-0d92-48ee-a352-f0c8d4e63b2b"]
-</code> +
- +
-We use "null" and "{}" as boundaries for the Card key.  +
- +
-Example respond: +
-<code json> +
-+
-    "errors": [], +
-    "protogrid_environment_version": "1.4.14", +
-    "result":+
-        "rows":+
-            { +
-                "key":+
-                    "12532072-0d76-4457-8cf8-7847d0470738", +
-                    "CWH ONE", +
-                    "4bcbdb7f-89c3-4640-b04e-3bd468df7c57" +
-                ], +
-                "shortname": "CWH ONE", +
-                "value": null +
-            }, +
-            ... +
-        ] +
-    } +
-+
-</code> +
- +
- +
-==== by_search_term_and_sortstring_and_id ==== +
-This view contains Cards for a certain search term by id. The key is composed of the search term, the Card sorting string and the Card key. Search term means a specific string, for which you want to find all Cards containing this string in the values. You may not find Cards having this string only in the labels of the fields. Example: +
-<code json> +
-["behavior", "ScriptLibrary:Server-ScriptLibrary Next Steps", "1475e62a-47d7-4a29-98c2-c89f50edd497"]+
 </code> </code>
 The value is null. 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 Cardyou see the Shortname of the referenced Card (say "wishes an offer"in the corresponding relation field. Nevertheless, the Card only stores the Card key of the related Card (say "c18bc1c2-5499-49cc-90e0-f06b4af1474f"), therefore you will not find Card A when searching for Cards containing "wishes"+Example request to get all Cardswhere the name (in my example having with fieldkey "816950eb-1b70-41e2-89f5-5400f9636345"starts with "nor "o":
- +
-Example request to find all cards containing the word "behavior":+
 <code> <code>
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_search_term_and_sortstring_and_id?start_key=["behavior", null, null]&end_key=["behavior", {}, {}]+https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_design_element_and_value_and_sortstring_and_id?start_key=["816950eb-1b70-41e2-89f5-5400f9636345","n",null,null]&end_key=["816950eb-1b70-41e2-89f5-5400f9636345","m",{},{}]
 </code> </code>
  
 Example response: Example response:
-<code json>+<code javascript >
 { {
     "errors": [],     "errors": [],
-    "protogrid_environment_version": "1.4.14", 
     "result": {     "result": {
-        "next_card_key": [ 
-            "behavior", 
-            "ScriptLibrary:Server-ScriptLibrary Products", 
-            "ba9859e1-68ad-4004-b8e0-c4f0812edf20" 
-        ], 
         "rows": [         "rows": [
             {             {
                 "key": [                 "key": [
-                    "behavior", +                    "816950eb-1b70-41e2-89f5-5400f9636345", 
-                    "ScriptLibrary:Server-ScriptLibrary Next Steps", +                    "night knight PRO", 
-                    "1475e62a-47d7-4a29-98c2-c89f50edd497"+                    "night knight PRO", 
 +                    "9a5f37ab-30a7-4c91-b99f-f573a1c7d1b9"
                 ],                 ],
-                "shortname": "ScriptLibrary:Server-ScriptLibrary Next Steps", 
                 "value": null                 "value": null
             },             },
             {             {
                 "key": [                 "key": [
-                    "behavior", +                    "816950eb-1b70-41e2-89f5-5400f9636345", 
-                    "ScriptLibrary:Server-ScriptLibrary Next Steps", +                    "nightTable 2.0", 
-                    "1475e62a-47d7-4a29-98c2-c89f50edd497"+                    "nightTable 2.0 furniture", 
 +                    "f6e2f9c9-e061-46f4-ab8f-a2594c2b38ae"
                 ],                 ],
-                "shortname": "ScriptLibrary:Server-ScriptLibrary Next Steps", 
                 "value": null                 "value": null
-            }+            }
-            { +
-                "key":+
-                    "behavior", +
-                    "ScriptLibrary:Server-ScriptLibrary Products", +
-                    "ba9859e1-68ad-4004-b8e0-c4f0812edf20" +
-                ], +
-                "shortname": "ScriptLibrary:Server-ScriptLibrary Products", +
-                "value": null +
-            }, +
-            ...+
         ]         ]
     }     }
Line 293: Line 242:
 </code> </code>
  
-You might have duplicates in the code due to several occurrences of the same search term on the same Card.+==== Proto Specific Views ====
  
-==== deleted_by_search_term_and_sortstring_and_id ==== +=== by_proto_and_sortstring_and_id ==== 
-This view contains all deleted Cards for a certain search term by id. The value is null. The request and response are analog to view [[#by_search_term_and_sortstring_and_id|"by_search_term_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, the Card sorting string 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.
  
-==== by_proto_and_search_term_and_sortstring_and_id ==== +Example Request to get all Cards belonging to the Proto with key "12532072-0d76-4457-8cf8-7847d0470738":
-This view contains all non-deleted and non-hidden Cards by proto and searchterm (see also [[#by_search_term_and_sortstring_and_id|by_search_term_and_sortstring_and_id]]. Therefore the key is composed of the Proto key, the searchterm, the Card sorting string and the Card key. Example:+
 <code> <code>
-["9c2bdd7d-05bd-4d16-8339-11116e737b3a", "wants", "Priscilla Molesworth wishes an offer Luxor 600t", "21f28df9-b0fd-431d-a773-5c6f58ff94a2"]+https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_sortstring_and_id?start_key=["12532072-0d76-4457-8cf8-7847d0470738",null,null]&end_key=["12532072-0d76-4457-8cf8-7847d0470738",{},{}]
 </code> </code>
  
-Example Request to get all Cards of Proto "9c2bdd7d-05bd-4d16-8339-11116e737b3a" containing the string "wants": +We use "null" and "{}" as boundaries for the Card key. 
-<code> +
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_search_term_and_sortstring_and_id?start_key=["9c2bdd7d-05bd-4d16-8339-11116e737b3a", "wants", null, null]&end_key=["9c2bdd7d-05bd-4d16-8339-11116e737b3a", "wants", {}, {}] +
-</code>+
  
-Example response+Example respond
-<code json>+<code javascript >
 { {
     "errors": [],     "errors": [],
-    "protogrid_environment_version": "1.4.14", 
     "result": {     "result": {
         "rows": [         "rows": [
             {             {
                 "key": [                 "key": [
-                    "9c2bdd7d-05bd-4d16-8339-11116e737b3a", +                    "12532072-0d76-4457-8cf8-7847d0470738", 
-                    "wants", +                    "CWH ONE", 
-                    "Priscilla Molesworth wishes an offer Luxor 600t", +                    "4bcbdb7f-89c3-4640-b04e-3bd468df7c57"
-                    "21f28df9-b0fd-431d-a773-5c6f58ff94a2"+
                 ],                 ],
-                "shortname": "Priscilla Molesworth - wishes an offer - Luxor 600t", 
                 "value": null                 "value": null
             },             },
Line 332: Line 274:
 </code> </code>
  
-==== by_design_element_and_value_and_sortstring_and_id ==== +=== by_proto_and_design_element_and_sortstring_and_id ===
-This view contains all non-deleted and non-hidden Cards by design_element, date and id. Therefore the key is composed of the key of the design element, the value of the design element, the Card sorting string and the Card key. Example: +
-<code> +
-["234486c7-939f-49f4-88b2-6fd51369a1d9", "Basic Toilet 2016 ", "Basic Toilet 2016 ", "d81047c2-0d92-48ee-a352-f0c8d4e63b2b"+
-</code> +
-The value is null. +
- +
-Example request to get all Cards, where the name (in my example having with fieldkey "816950eb-1b70-41e2-89f5-5400f9636345") starts with "n" or "o": +
-<code> +
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_design_element_and_value_and_sortstring_and_id?start_key=["816950eb-1b70-41e2-89f5-5400f9636345", "n", null, null]&end_key=["816950eb-1b70-41e2-89f5-5400f9636345", "m", {}, {}] +
-</code> +
- +
-Example response: +
-<code json> +
-+
-    "errors": [], +
-    "protogrid_environment_version": "1.4.14", +
-    "result":+
-        "rows":+
-            { +
-                "key":+
-                    "816950eb-1b70-41e2-89f5-5400f9636345", +
-                    "night knight PRO", +
-                    "night knight PRO", +
-                    "9a5f37ab-30a7-4c91-b99f-f573a1c7d1b9" +
-                ], +
-                "shortname": "night knight PRO", +
-                "value": null +
-            }, +
-            { +
-                "key":+
-                    "816950eb-1b70-41e2-89f5-5400f9636345", +
-                    "nightTable 2.0", +
-                    "nightTable 2.0 - furniture", +
-                    "f6e2f9c9-e061-46f4-ab8f-a2594c2b38ae" +
-                ], +
-                "shortname": "nightTable 2.0 - furniture", +
-                "value": null +
-            } +
-        ] +
-    } +
-+
-</code>+
  
-==== by_proto_and_design_element_and_value_and_sortstring_and_id ====+=== by_proto_and_design_element_and_value_and_sortstring_and_id ===
 This view contains all non-deleted and non-hidden Cards by  Proto, design_element, date and id. Therefore the keys is composed of the Proto key, the fieldkey of the design element, the value of the design element, the Card sorting string and the Card key. Example: This view contains all non-deleted and non-hidden Cards by  Proto, design_element, date and id. Therefore the keys is composed of the Proto key, the fieldkey of the design element, the value of the design element, the Card sorting string and the Card key. Example:
 <code> <code>
Line 385: Line 285:
 Example Request to find all Cards based on Proto "12532072-0d76-4457-8cf8-7847d0470738" whos price ("ed2c109d-a825-4b97-a0bb-31c13185408d") lies between 400 and 500: Example Request to find all Cards based on Proto "12532072-0d76-4457-8cf8-7847d0470738" whos price ("ed2c109d-a825-4b97-a0bb-31c13185408d") lies between 400 and 500:
 <code> <code>
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_design_element_and_value_and_sortstring_and_id?start_key=["12532072-0d76-4457-8cf8-7847d0470738","ed2c109d-a825-4b97-a0bb-31c13185408d", "400", null, null]&end_key=["12532072-0d76-4457-8cf8-7847d0470738", "ed2c109d-a825-4b97-a0bb-31c13185408d", "500", {}, {}]+https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_design_element_and_value_and_sortstring_and_id?start_key=["12532072-0d76-4457-8cf8-7847d0470738","ed2c109d-a825-4b97-a0bb-31c13185408d","400",null,null]&end_key=["12532072-0d76-4457-8cf8-7847d0470738","ed2c109d-a825-4b97-a0bb-31c13185408d","500",{},{}]
 </code> </code>
  
 Example response: Example response:
-<code json>+<code javascript >
 { {
     "errors": [],     "errors": [],
-    "protogrid_environment_version": "2.0beta7", 
     "result": {     "result": {
         "rows": [         "rows": [
Line 403: Line 302:
                     "4bcbdb7f-89c3-4640-b04e-3bd468df7c57"                     "4bcbdb7f-89c3-4640-b04e-3bd468df7c57"
                 ],                 ],
-                "shortname": "CWH ONE - toilet", 
                 "value": null                 "value": null
             },             },
Line 414: Line 312:
                     "e086c668-500b-4acf-982c-df4f3be65a6b"                     "e086c668-500b-4acf-982c-df4f3be65a6b"
                 ],                 ],
-                "shortname": "ForestFire 2016 - lawn mover", 
                 "value": null                 "value": null
             }             }
Line 422: Line 319:
 </code> </code>
  
-==== deleted_by_design_element_and_value_and_sortstring_and_id ==== +==== Views for Deleted Cards ====
-This view contains all deleted Cards for a certain search term by design_element, date and id. The value is null. The request and response are analog to view [[#by_design_element_and_value_and_sortstring_and_id|"by_design_element_and_value_and_sortstring_and_id"]].+
  
-==== all_protos_by_id ==== +=== deleted_by_sortstring_and_id === 
-This view contains all Protos by id. The value contains shortname and a list of design_elements.+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_sortstring_and_id|"by_sortstring_and_id"]].
  
-Example request to get the first 5 protos: +=== deleted_by_design_element_and_sortstring_and_id === 
-<code> +This view contains all deleted Cards sorted by a certain design elementThe value is null. The request and response are analog to view [[#by_design_element_and_sortstring_and_id|"by_design_element_and_sortstring_and_id"]].
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/all_protos_by_id?limit=5 +
-</code>+
  
-Example respond: +=== deleted_by_design_element_and_value_and_sortstring_and_id === 
-<code json> +This view contains all deleted Cards by a certain Protodesign_elementvaluesortstring and id. The value is null. The request and response are analog to view [[#by_design_element_and_value_and_sortstring_and_id|"by_design_element_and_value_and_sortstring_and_id"]].
-+
-    "errors": [], +
-    "protogrid_environment_version": "1.4.14", +
-    "result":+
-        "next_card_key": "&&protosTableViewProto", +
-        "rows":+
-            { +
-                "key": "&&allTableViewProto", +
-                "shortname": "Proto:All Cards By ID", +
-                "value": { +
-                    "design_elements": [ +
-                        "name"+
-                        "plural_name", +
-                        "theme_color", +
-                        "enable_attachments", +
-                        "enable_filtering_for_id", +
-                        "script_library", +
-                        "editor_role", +
-                        "allow_editing_cards_to_users", +
-                        "show_cards_to_users", +
-                        "creator_role", +
-                        "automatically_created_tableview_proto", +
-                        "comment", +
-                        "card_design_elements", +
-                        "cards_based_on_this" +
-                    ]+
-                    "shortname":+
-                        "en": "Proto:All Cards By ID" +
-                    } +
-                } +
-            }, +
-            ... +
-        ] +
-    } +
-+
-</code>+
  
 +==== Views for Navigation in Relational Tree (Up / Down) ====
  
-==== related_keys_by_id ====+=== related_keys_by_id ===
 This view contains all Cards by id. The value contains the related keys. This view contains all Cards by id. The value contains the related keys.
- 
-**Be aware**: This is one of the very few views, where the key is **NOT** surrounded by "[ ... ]"! 
  
 Example request to find all Cards related to the Card "234486c7-939f-49f4-88b2-6fd51369a1d9": Example request to find all Cards related to the Card "234486c7-939f-49f4-88b2-6fd51369a1d9":
 <code> <code>
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/related_keys_by_id?keys=["234486c7-939f-49f4-88b2-6fd51369a1d9"]+https://example.protogrid.com/api/v2/apps/produktekatalog/views/related_keys_by_id?keys=[["234486c7-939f-49f4-88b2-6fd51369a1d9"]]
 </code> </code>
  
 Example response: Example response:
-<code json>+<code javascript >
 { {
     "errors": [],     "errors": [],
-    "protogrid_environment_version": "1.4.15", 
     "result": {     "result": {
         "rows": [         "rows": [
             {             {
-                "key": "234486c7-939f-49f4-88b2-6fd51369a1d9", +                "key": 
-                "shortname": "name",+                    "234486c7-939f-49f4-88b2-6fd51369a1d9" 
 +                ],
                 "value": [                 "value": [
                     [                     [
Line 537: Line 394:
 </code> </code>
  
-==== relating_cards_by_related_key ====+=== 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 Card key and the Relating Card key. The value is null. This view contains all Relating Cards of the (Related) Card specified by key. The key is composed of the Related Card key and the Relating Card key. The value is null.
  
 Example request to find all Cards relating to the (Related) Card with key "626f04f7-179d-40d7-99f0-9e54343abf98": Example request to find all Cards relating to the (Related) Card with key "626f04f7-179d-40d7-99f0-9e54343abf98":
 <code> <code>
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/relating_cards_by_related_key?start_key=["626f04f7-179d-40d7-99f0-9e54343abf98", null]&end_key=["626f04f7-179d-40d7-99f0-9e54343abf98", {}]+https://example.protogrid.com/api/v2/apps/produktekatalog/views/relating_cards_by_related_key_and_id?start_key=["626f04f7-179d-40d7-99f0-9e54343abf98",null]&end_key=["626f04f7-179d-40d7-99f0-9e54343abf98",{}]
 </code> </code>
  
 Example response: Example response:
-<code json>+<code javascript >
 { {
     "errors": [],     "errors": [],
-    "protogrid_environment_version": "1.4.15", 
     "result": {     "result": {
         "rows": [         "rows": [
Line 557: Line 413:
                     "00ded64d-5e1b-42a1-a61e-f8e46c0c552a"                     "00ded64d-5e1b-42a1-a61e-f8e46c0c552a"
                 ],                 ],
-                "shortname": "Liguan 2.0 TDI", 
                 "value": null                 "value": null
             },             },
Line 565: Line 420:
                     "50a9098b-bd4e-47fe-9e99-7d8f1d43517a"                     "50a9098b-bd4e-47fe-9e99-7d8f1d43517a"
                 ],                 ],
-                "shortname": "Paolo Schnuffi - wishes a callback ", 
                 "value": null                 "value": null
             },             },
Line 573: Line 427:
                     "5d068708-9546-4536-94c6-da27b6a909b2"                     "5d068708-9546-4536-94c6-da27b6a909b2"
                 ],                 ],
-                "shortname": "Freddie Mac - wishes a callback  - nightTable 2.0", 
                 "value": null                 "value": null
             },             },
Line 581: Line 434:
                     "fa6f178c-a398-4852-a3b3-7e66978c9a65"                     "fa6f178c-a398-4852-a3b3-7e66978c9a65"
                 ],                 ],
-                "shortname": "EcoDischarger", 
                 "value": null                 "value": null
             },             },
Line 589: Line 441:
                     "fbf79fc6-2da1-41f2-9954-1606dbe3fa01"                     "fbf79fc6-2da1-41f2-9954-1606dbe3fa01"
                 ],                 ],
-                "shortname": "Liguan 2.0 TDI", 
                 "value": null                 "value": null
             }             }
Line 596: Line 447:
 } }
 </code> </code>
-==== tableview_data_by_id ====+ 
 +==== Views for Direct Human Readable Presentation ==== 
 + 
 +=== tableview_data_by_id ===
 This view contains all Cards contained in a tableview by id. The value contains the raw card.  This view contains all Cards contained in a tableview by id. The value contains the raw card. 
  
Line 605: Line 459:
  
 Example response: Example response:
-<code json>+<code javascript >
 { {
     "errors": [],     "errors": [],
-    "protogrid_environment_version": "1.4.15", 
     "result": {     "result": {
         "rows": [         "rows": [
             {             {
-                "key": "5f12ccf6-9de0-4796-d366-106e4b7b8af9", +                "key": 
-                "shortname": "Card: 5f12ccf6-9de0-4796-d366-106e4b7b8af9",+                    "5f12ccf6-9de0-4796-d366-106e4b7b8af9" 
 +                ],
                 "value": {                 "value": {
                     "#": [                     "#": [
Line 654: Line 508:
 </code> </code>
  
- +=== shortname_objects_by_id === 
-==== shortname_by_language_objects_by_id ==== +This view contains all Cards which contain shortname data by id. The value contains the shortnames by language.
-This view contains all Cards which contains shortname data by id. The value contains the shortnames by language.+
  
 Example request to get the shortnames of the Card with key "a0e6717f-c613-404a-bc08-a090311c651c": Example request to get the shortnames of the Card with key "a0e6717f-c613-404a-bc08-a090311c651c":
 <code> <code>
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/shortname_by_language_objects_by_id?keys=[["a0e6717f-c613-404a-bc08-a090311c651c"]]+https://example.protogrid.com/api/v2/apps/produktekatalog/views/shortname_objects_by_id?keys=[["a0e6717f-c613-404a-bc08-a090311c651c"]]
 </code> </code>
  
 Example response: Example response:
-<code json>+<code javascript >
 { {
     "errors": [],     "errors": [],
-    "protogrid_environment_version": "1.4.15", 
     "result": {     "result": {
         "rows": [         "rows": [
             {             {
-                "key": "a0e6717f-c613-404a-bc08-a090311c651c", +                "key": 
-                "shortname": "Priscilla Molesworth - wishes an offer",+                    "a0e6717f-c613-404a-bc08-a090311c651c" 
 +                ],
                 "value": {                 "value": {
                     "de": "Priscilla Molesworth - wishes an offer",                     "de": "Priscilla Molesworth - wishes an offer",
Line 683: Line 536:
 </code> </code>
  
-==== sums_by_proto_and_design_element  ==== +===== Views of Dedicated Search Dialog Boxes ===== 
-Sums over the values of a number field for all Cards of a [[Proto]].+It is also possible to access the views of dedicated [[protogrid:TableView#Search Dialog Boxes|Search Dialog Box]] from the JSON API. Just use the Card ID of the Search Dialog Box as view name.
  
-Example Request to sum all prices (Field Key “816950eb-1b70-41e2-89f5-5400f9636345”) of all products (Proto Key “12532072-0d76-4457-8cf8-7847d0470738”):+HintFor straight forward API usage in most cases it is recommended to use Search Dialog Boxes in "Simple Keys in JSON API only" display mode.
  
 +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 as a sort field or filter field with range (greater/less than option enabled), the time portion is left as it is (example: "2021-11-11T22:22:00.000Z").
 +
 +Example Request:
 <code> <code>
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/sums_by_proto_and_design_element?keys=[["12532072-0d76-4457-8cf8-7847d0470738", "816950eb-1b70-41e2-89f5-5400f9636345"]]+https://example.protogrid.com/api/v2/apps/produktekatalog/views/869a18bf-2fb6-4d6d-afe4-3b6283f35ba3
 </code> </code>
  
-Example Response: +The key depends on the individually configured Filter Fields for the acessed Search Dialog Box.
-<code json> +
-+
-    "errors": [], +
-    "protogrid_environment_version": "2.0beta7", +
-    "result":+
-        "rows":+
-            { +
-                "key": [ +
-                    "12532072-0d76-4457-8cf8-7847d0470738", +
-                    "816950eb-1b70-41e2-89f5-5400f9636345" +
-                ], +
-                "value": 208991 +
-            } +
-        ], +
-        "total_rows":+
-    } +
-+
-</code>+
  
-==== sums_by_proto_and_design_element_and_condition ==== +===== Change Log ===== 
-Sums over the values of a number field for all Cards of a [[Proto]] given a condition from another field.+==== Standard Views Decommissioned With Version 2.1.5 ==== 
 +  * by_id_and_value 
 +  * by_proto_and_search_term_and_id 
 +  * by_search_term_and_id 
 +  * data_protos_by_id 
 +  * 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
  
-This endpoint requires four query key components: +==== Standard Views Decommissioned With Version 2.2.1 ==== 
-  - The Proto key +  * by_design_element_and_value_and_id 
-  - The design element key for the field to sum over +  * by_proto_and_id 
-  - The design element key for the condition field +  * by_proto_and_design_element_and_value_and_id 
-  - The conditional value in the field specified in third key component +  * deleted_by_proto_and_design_element_and_value_and_id 
-Example: What is the sum of all values in the “Total” field in the Proto “Invoice”, given that the relation field “customer” holds the key for “John Smith”? +  * 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
  
-Example Request to sum all prices (Field Key "816950eb-1b70-41e2-89f5-5400f9636345"of all products (Proto Key "12532072-0d76-4457-8cf8-7847d0470738") where the product group (Field Key "359a18bf-2fb6-4d6d-afe4-3b6283f35b50") is furniture (Card Key "fde10c41-7e7c-45a2-bbf3-3065de5e05ad")+==== Adjustments to Views With Version 2.2.2 ==== 
-<code+  - All views: If a view is requested with the "descending" parameter set to true "start_key" and "end_key" must now be exchanged. 
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/sums_by_proto_and_design_element_and_condition?keys=[["12532072-0d76-4457-8cf8-7847d0470738","816950eb-1b70-41e2-89f5-5400f9636345","359a18bf-2fb6-4d6d-afe4-3b6283f35b50","fde10c41-7e7c-45a2-bbf3-3065de5e05ad"]+  All views: All string values as well as sortstrings are now cut off after 300 characters. 
-</code>+  All views: The separator between human readable values and keys is now "\u0009" instead of "\u9999"
 +  All views: The second last column "sortstring" is now indexed in a shorter manner: "<SORTSTRING>" instead of "<PROTO KEY>\u9999<SORTSTRING>\u9999<CARD KEY>" 
 +  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:00:00.000Z”). If the date-time value is configured as a sort field or filter field with range (greater/less than option enabled), the time portion is left as it is (example: “2021-11-11T22:22:00.000Z”). 
 +  Dedicated Search Boxes with "sortable" display mode: Columns are now indexed in a shorter manner
 +    * For Relation/Tag Field values: "SORTSTRING >\u0009<KEY>" instead of "<SORTSTRING>\u9999<KEY>\u9999<KEY>" 
 +    * For other field values"<VALUE>" instead of "\u9999<VALUE>\u9999<VALUE>" 
 +    * Note: It is anyway recommended to use Search Dialog Boxes with display mode “Simple Keys in JSON API only” (ienon-sortable). 
 +  - In views "by_design_element_and_sortstring_and_id", "by_proto_and_design_element_and_sortstring_and_id" and "deleted_by_design_element_and_sortstring_and_id" the design element's sortstrings are now indexed in a shorter manner: 
 +    * For Relation/Tag Field values: "< SORTSTRING >\u0009<KEY>" instead of "<SORTSTRING>\u9999<KEY>\u9999<KEY>" 
 +    * For other field values: "<VALUE>" instead of "\u9999<VALUE>\u9999<VALUE>" 
 +    * Note: If you don't explicitly need sorting by design element value is anyway recommended to use the views "by_design_element_and_value_and_sortstring_and_id", by_proto_and_design_element_and_value_and_sortstring_and_id"" or "deleted_by_design_element_and_value_and_sortstring_and_id"
 +  - In views "by_design_element_and_sortstring_and_id", "by_proto_and_design_element_and_sortstring_and_id" and "deleted_by_design_element_and_sortstring_and_id" there is a new column for the Card's sortstring after the design element's sortstring. Example: 
 +    * View columns of "by_design_element_and_sortstring_and_id" before: ["816950eb-1b70-41e2-89f5-5400f9636345", "nightTable 2.0", "9a5f37ab-30a7-4c91-b99f-f573a1c7d1b9"
 +    * View columns of by_design_element_and_sortstring_and_id"" now: ["816950eb-1b70-41e2-89f5-5400f9636345", "nightTable 2.0", "nightTable 2.0 furniture", "9a5f37ab-30a7-4c91-b99f-f573a1c7d1b9"]
  
-Example Response: +==== Standard Views Decommissioned With Version 2.6.0 ==== 
-<code json> +  * by_search_term_and_sortstring_and_id 
-+  * by_proto_and_search_term_and_sortstring_and_id 
-    "errors": [], +  * deleted_by_search_term_and_sortstring_and_id 
-    "protogrid_environment_version": "2.0beta7", +  * navroot_candidates_by_sortstring_and_id 
-    "result":+  * navroot_candidates_by_search_term_and_sortstring_and_id 
-        "rows":+  * data_protos_by_sortstring_and_id 
-            { +  * data_protos_by_search_term_and_sortstring_and_id
-                "key":+
-                    "12532072-0d76-4457-8cf8-7847d0470738", +
-                    "816950eb-1b70-41e2-89f5-5400f9636345", +
-                    "359a18bf-2fb6-4d6d-afe4-3b6283f35b50", +
-                    "fde10c41-7e7c-45a2-bbf3-3065de5e05ad" +
-                ], +
-                "value": 53821 +
-            } +
-        ], +
-        "total_rows":+
-    } +
-+
-</code> +
- +
-===== Views of Dedicated Search Dialog Boxes ===== +
-It is also possible to access the views of dedicated [[protogrid:TableView#Search Dialog Boxes|Search Dialog Box]] from the JSON API. Just use the Card ID of the Search Dialog Box as view name. +
- +
-Example Request: +
-<code> +
-https://example.protogrid.com/api/v2/apps/produktekatalog/views/869a18bf-2fb6-4d6d-afe4-3b6283f35ba3 +
-</code> +
- +
-The key depends on the individually configured Filter Fields for the acessed Search Dialog Box.+
Print/export