This is an old revision of the document!


JSON API Database Views

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:

{
  "errors": [],
  "protogrid_environment_version": "1.4.10",
  "result": {
    "rows": [
      {
        "key": [
          "12532072-0d76-4457-8cf8-7847d0470738",
          "4bcbdb7f-89c3-4640-b04e-3bd468df7c57"
        ],
        "shortname": "CWH ONE",
        "value": null
      },
      {
        "key": [
          "12532072-0d76-4457-8cf8-7847d0470738",
          "7e3e7a96-6ea7-4dc7-a58a-1c781ae35e7b"
        ],
        "shortname": "DirtKiller 64 -  washing machines",
        "value": null
      },
      {
        "key": [
          "12532072-0d76-4457-8cf8-7847d0470738",
          "89e74e40-b0ef-4bc3-8e89-a43a43763087"
        ],
        "shortname": "SuperCleaner 2000 -  washing machines",
        "value": null
      }
    ]
  }
}

For details about listings / views and how to request it, please see section about view 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.

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.

Example request to get the first 5 Cards with ids which are lexicographically between “4d523d95-31dd-4cb3-b60a-c974404e4ffd” and “5f09e616-9883-41cb-8986-a0f2ec690971”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/all_by_id?start_key=["4d523d95-31dd-4cb3-b60a-c974404e4ffd"]&end_key=["5f09e616-9883-41cb-8986-a0f2ec690971"]&limit=5

Example respond:

{
  "errors": [],
  "protogrid_environment_version": "1.4.10",
  "result": {
    "next_card_key": [
    "51b97f49-3262-4339-a8c7-2e8166887761"
    ],
    "rows": [
    {
      "key": [
      "4d523d95-31dd-4cb3-b60a-c974404e4ffd"
      ],
      "shortname": {},
      "value": null
      },
      ...
      ]
    }
  }

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.protogrid.com/api/v2/apps/produktekatalog/views/all_protos_by_id?limit=5

Example respond:

{
    "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"
                    }
                }
            },
            ...
        ]
    }
}

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.

Example request to get all IDs with the Cards content (with flag “include_cards=true”):

https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_id?start_key=[null]&end_key=[{}]&include_cards=true

Example respond (be aware, that this Card is a System Card and therefore looks different to the typical Cards):

{
    "errors": [],
    "protogrid_environment_version": "1.4.14",
    "result": {
        "next_card_key": [
            "&&logTableViewDefinition"
        ],
        "rows": [
            {
                "doc": {
                    "_id": "&&adminMenuDefinition",
                    "_rev": "36-511c0128517aac0c5f4d3dbc22d6451a",
                    "definition_type": "Menu",
                    "denormalized": {
                        "&&adminMenuDefinition": {
                            "displayable_type": {
                                "en": "MenuDefinition"
                            },
                            "shortname": {
                                "en": "Menu:Administration"
                            }
                        },
                        "ac722839-acc7-4683-e9cf-0d2eb3137575": {
                            "displayable_type": {
                                "de": "DynamicCard",
                                "en": "DynamicCard"
                            },
                            "shortname": {
                                "de": "Schritttypen",
                                "en": "types of steps"
                            }
                        },
                        ...
                    },
                    "design_elements": [
                        {
                            "disable_label": false,
                            "display_priority": 10,
                            "element_type": "MultilanguageText",
                            "grid_size_setting": 0,
                            "help_text": "",
                            "hidden": false,
                            "label_multilanguage_key": "&&mlkey_menu_title_key",
                            "list_priority": 0,
                            "multiple_values_setting": 0,
                            "name": "title",
                            "requirement_setting": 0,
                            "show_to_users": 0,
                            "user_enabled_setting": 0,
                            "value": "&&mlkey_admin_menu_header",
                            "value_type": "key"
                        },
                        {
                            "allow_new_cards": false,
                            "cardinality_setting": 2,
                            "couchdb_viewname": "navroot_candidates",
                            "disable_label": false,
                            "display_priority": 10,
                            "element_type": "Relation",
                            "grid_size_setting": 0,
                            "help_text": "",
                            "hidden": false,
                            "label_multilanguage_key": "&&mlkey_menu_entries",
                            "multiple_values_setting": 1,
                            "name": "menu_entries",
                            "parent_application_setting": "",
                            "parent_entity_proto_setting": "",
                            "requirement_setting": 0,
                            "show_card_type": false,
                            "show_created_setting": false,
                            "show_creator_setting": false,
                            "show_modified_setting": false,
                            "show_modifier_setting": false,
                            "show_short_name_setting": true,
                            "show_to_users": 0,
                            "user_enabled_setting": 0,
                            "value": [
                                "&&allTableViewCard",
                                "&&logTableViewCard",
                                "&&trashTableViewCard",
                                "&&importExportCard",
                                "ac722839-acc7-4683-e9cf-0d2eb3137575",
                                "502ece2e-0bd5-43c6-dd26-2bc368261ee0"
                            ],
                            "value_type": "key"
                        }
                    ],
                    "get_shortname": {},
                    "hidden": false,
                    "last_healed": "2017-04-14T06:44:52",
                    "modification_log": [
                        {
                            "time": "2016-03-23T12:11:47",
                            "user": "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e"
                        },
                        ...
                    ],
                    "reader_role_key": "",
                    "set_element_value": {},
                    "title_multilanguage_key": "&&mlkey_menu_definition_key",
                    "user_creatable": true
                },
                "key": [
                    "&&adminMenuDefinition"
                ],
                "shortname": "Menu:Administration",
                "value": null
            },
           ...
        ]
    }
}

deleted_by_sortstring_and_id

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_proto_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.

Example Request to get all Cards belonging to the Proto with key “12532072-0d76-4457-8cf8-7847d0470738”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_id?start_key=["12532072-0d76-4457-8cf8-7847d0470738", null]&end_key=["12532072-0d76-4457-8cf8-7847d0470738", {}]

We use “null” and “{}” as boundaries for the Card key.

Example respond:

{
    "errors": [],
    "protogrid_environment_version": "1.4.14",
    "result": {
        "rows": [
            {
                "key": [
                    "12532072-0d76-4457-8cf8-7847d0470738",
                    "4bcbdb7f-89c3-4640-b04e-3bd468df7c57"
                ],
                "shortname": "CWH ONE",
                "value": null
            },
            ...
        ]
    }
}

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_id_and_value.

by_proto_and_shortname_and_id

This View contains all non-deleted and non-hidden Cards with corresponding Proto and shortname by id. This means the key is composed of the Proto key, the shortname and the Card ID. Example:

["12532072-0d76-4457-8cf8-7847d0470738", "SuperCleaner 2000 - washing machines", "89e74e40-b0ef-4bc3-8e89-a43a43763087"]

The value is null. 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 to get the cards based on the Shortname as follows:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_id?start_key=["2843c3cf-abee-45a5-a869-e0ea9703c7c0", "sewer cover", null]&end_key=["2843c3cf-abee-45a5-a869-e0ea9703c7c0", "sewer cover", {}]

Example respond:

{
    "errors": [],
    "protogrid_environment_version": "1.4.14",
    "result": {
        "rows": [
            {
                "key": [
                    "2843c3cf-abee-45a5-a869-e0ea9703c7c0",
                    "sewer cover",
                    "f8f9f426-0d72-42bf-bd00-c9164d500334"
                ],
                "shortname": "sewer cover",
                "value": null
            },
            {
                "key": [
                    "2843c3cf-abee-45a5-a869-e0ea9703c7c0",
                    "sewer cover",
                    "f8f9f426-0d72-42bf-bd00-c9164d500334"
                ],
                "shortname": "sewer cover",
                "value": null
            }
        ]
    }
}

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:

["behavior", "ScriptLibrary:Server-ScriptLibrary Next Steps", "1475e62a-47d7-4a29-98c2-c89f50edd497"]

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 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 find all cards containing the word “behavior”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_search_term_and_sortstring_and_id?start_key=["behavior", null, null]&end_key=["behavior", {}, {}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.14",
    "result": {
        "next_card_key": [
            "behavior",
            "ScriptLibrary:Server-ScriptLibrary Products",
            "ba9859e1-68ad-4004-b8e0-c4f0812edf20"
        ],
        "rows": [
            {
                "key": [
                    "behavior",
                    "ScriptLibrary:Server-ScriptLibrary Next Steps",
                    "1475e62a-47d7-4a29-98c2-c89f50edd497"
                ],
                "shortname": "ScriptLibrary:Server-ScriptLibrary Next Steps",
                "value": null
            },
            {
                "key": [
                    "behavior",
                    "ScriptLibrary:Server-ScriptLibrary Next Steps",
                    "1475e62a-47d7-4a29-98c2-c89f50edd497"
                ],
                "shortname": "ScriptLibrary:Server-ScriptLibrary Next Steps",
                "value": null
            },
            {
                "key": [
                    "behavior",
                    "ScriptLibrary:Server-ScriptLibrary Products",
                    "ba9859e1-68ad-4004-b8e0-c4f0812edf20"
                ],
                "shortname": "ScriptLibrary:Server-ScriptLibrary Products",
                "value": null
            },
            ...
        ]
    }
}

You might have duplicates in the code due to several occurrences of the same search term on the same Card.

deleted_by_search_term_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_proto_and_search_term_and_id

This view contains all non-deleted and non-hidden Cards by proto and searchterm (see also by_search_term_and_id. Therefore the key is composed of the Proto key, the searchterm and the Card key. Example:

["9c2bdd7d-05bd-4d16-8339-11116e737b3a", "wants", "21f28df9-b0fd-431d-a773-5c6f58ff94a2"]

Example Request to get all Cards of Proto “9c2bdd7d-05bd-4d16-8339-11116e737b3a” containing the string “wants”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_search_term_and_id?start_key=["9c2bdd7d-05bd-4d16-8339-11116e737b3a", "wants", null]&end_key=["9c2bdd7d-05bd-4d16-8339-11116e737b3a", "wants",{}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.14",
    "result": {
        "rows": [
            {
                "key": [
                    "9c2bdd7d-05bd-4d16-8339-11116e737b3a",
                    "wants",
                    "21f28df9-b0fd-431d-a773-5c6f58ff94a2"
                ],
                "shortname": "Priscilla Molesworth - wishes an offer - Luxor 600t",
                "value": null
            },
            ...
        ]
    }
}

by_design_element_and_value_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 and the id of the Card. Example:

["234486c7-939f-49f4-88b2-6fd51369a1d9", "Basic Toilet 2016 ", "d81047c2-0d92-48ee-a352-f0c8d4e63b2b"]

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”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_design_element_and_value_and_id?start_key=["816950eb-1b70-41e2-89f5-5400f9636345", "n", null]&end_key=["816950eb-1b70-41e2-89f5-5400f9636345", "m", {}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.14",
    "result": {
        "rows": [
            {
                "key": [
                    "816950eb-1b70-41e2-89f5-5400f9636345",
                    "night knight PRO",
                    "9a5f37ab-30a7-4c91-b99f-f573a1c7d1b9"
                ],
                "shortname": "night knight PRO",
                "value": null
            },
            {
                "key": [
                    "816950eb-1b70-41e2-89f5-5400f9636345",
                    "nightTable 2.0",
                    "f6e2f9c9-e061-46f4-ab8f-a2594c2b38ae"
                ],
                "shortname": "nightTable 2.0 - furniture",
                "value": null
            }
        ]
    }
}

deleted_by_design_element_and_value_and_id

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_id".

by_proto_and_design_element_and_value_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 and the Card key. Example:

["9c2bdd7d-05bd-4d16-8339-11116e737b3a", "&&created", "2016-09-17T20:47:52", "398f0b4c-cbb9-42c9-b4e0-e5c2e7913ec5"]

The value is null. You typically want to use this view to query on system fields such as “&&created” or “&&shortname”, which are available on all Protos.

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:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_proto_and_design_element_and_value_and_id?start_key=["12532072-0d76-4457-8cf8-7847d0470738","ed2c109d-a825-4b97-a0bb-31c13185408d", "400", null]&end_key=["12532072-0d76-4457-8cf8-7847d0470738", "ed2c109d-a825-4b97-a0bb-31c13185408d", "500", {}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "2.0beta7",
    "result": {
        "rows": [
            {
                "key": [
                    "12532072-0d76-4457-8cf8-7847d0470738",
                    "ed2c109d-a825-4b97-a0bb-31c13185408d",
                    "449",
                    "4bcbdb7f-89c3-4640-b04e-3bd468df7c57"
                ],
                "shortname": "CWH ONE - toilet",
                "value": null
            },
            {
                "key": [
                    "12532072-0d76-4457-8cf8-7847d0470738",
                    "ed2c109d-a825-4b97-a0bb-31c13185408d",
                    "499",
                    "e086c668-500b-4acf-982c-df4f3be65a6b"
                ],
                "shortname": "ForestFire 2016 - lawn mover",
                "value": null
            }
        ]
    }
}

This view contains all relational definitions field key and Proto Key. This means that assuming we have a Relation Field (with the field key “359a18bf-2fb6-4d6d-afe4-3b6283f35b50”) whose related Proto has the Proto Key “2843c3cf-abee-45a5-a869-e0ea9703c7c0”, the key looks as follows:

["359a18bf-2fb6-4d6d-afe4-3b6283f35b50", "2843c3cf-abee-45a5-a869-e0ea9703c7c0"]

The value is null.

Example Request to find the Proto to which the relation field with key “5d41e440-7ddb-4837-bd28-ed32839c4d7a” is related:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/relational_definitions_by_id_and_related_proto?start_key=["5d41e440-7ddb-4837-bd28-ed32839c4d7a", null]&end_key=["5d41e440-7ddb-4837-bd28-ed32839c4d7a", {}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "2.0beta7",
    "result": {
        "next_card_key": [
            "5d41e440-7ddb-4837-bd28-ed32839c4d7a",
            "a9e1f5b1-44d7-4fe7-8fac-748a251239d8"
        ],
        "rows": [
            {
                "key": [
                    "5d41e440-7ddb-4837-bd28-ed32839c4d7a",
                    "a9e1f5b1-44d7-4fe7-8fac-748a251239d8"
                ],
                "shortname": "TableView:types of steps",
                "value": null
            },
            ...
        ]
    }
}

data_protos_by_id

This view lists all data Protos by id. The value is null. You may want to use this to list all data Protos or to find a given Proto.

Example request to get all data Protos:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/data_protos_by_id?start_key=[null]&end_key=[{}]&include_cards=true

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.15",
    "result": {
        "rows": [
            {
                "doc": {
                    "_id": "12532072-0d76-4457-8cf8-7847d0470738",
                    "_rev": "60-5cbfade7a369b55b58688fe0934a715d",
                    "definition_type": "Proto",
                    "denormalized": {
                        "08a1bb54-4927-4736-9a7a-44c677d7ec0d": {
                            "displayable_type": {
                                "de": "DynamicCard",
                                "en": "DynamicCard"
                            },
                            "shortname": {
                                "de": "Products",
                                "en": "Products"
                            }
                        },
                        ...
                    },
                    "design_elements": [
                        {
                            "disable_label": false,
                            "display_priority": 10,
                            "element_type": "MultilanguageText",
                            "grid_size_setting": 0,
                            "help_text": "&&mlkey_proto_name_help_text",
                            "hidden": false,
                            "label_multilanguage_key": "&&mlkey_card_name",
                            "list_priority": 0,
                            "multiple_values_setting": 0,
                            "name": "name",
                            "requirement_setting": 1,
                            "show_to_users": 0,
                            "user_enabled_setting": 0,
                            "value": "c4472c16-c7c3-4e11-eba9-73b69fca32cf",
                            "value_type": "key"
                        },
                        ...
                    ],
                    "get_shortname": {},
                    "hidden": false,
                    "last_healed": "2016-07-06T14:17:13",
                    "modification_log": [
                        {
                            "time": "2016-03-23T12:23:37",
                            "user": "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e"
                        },
                        ...
                    ],
                    "reader_role_key": "",
                    "set_element_value": {},
                    "title_multilanguage_key": "&&mlkey_proto_definition_key",
                    "user_creatable": true
                },
                "key": [
                    "12532072-0d76-4457-8cf8-7847d0470738"
                ],
                "shortname": "Proto:Product",
                "value": null
            },
            ...
        ]
    }
}

data_protos_by_search_term_and_id

This view contains all data Protos for a certain search term and by id. Possible search terms are the linked roles, the linked overview proto or name parts of the chosen color (such as “light” or “green”). The value is null.

Example request to get all data Protos linked with the role “201d4953-b50b-4833-921f-9e3ee2bfdac3”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/data_protos_by_search_term_and_id?start_key=["201d4953-b50b-4833-921f-9e3ee2bfdac3", null]&end_key=["201d4953-b50b-4833-921f-9e3ee2bfdac3", {}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.15",
    "result": {
        "next_card_key": [
            "201d4953-b50b-4833-921f-9e3ee2bfdac3",
            "9c2bdd7d-05bd-4d16-8339-11116e737b3a"
        ],
        "rows": [
            {
                "key": [
                    "201d4953-b50b-4833-921f-9e3ee2bfdac3",
                    "12532072-0d76-4457-8cf8-7847d0470738"
                ],
                "shortname": "Proto:Product",
                "value": null
            },
            ...
        ]
    }
}

datetime_field_definitions_by_id

This view contains all datetime field definitions by id. The value is null.

Example request to find all datetime field definitions of an app:

https://example.protogrid.com/api/v2/apps/ppad/views/datetime_field_definitions_by_id?start_key=[null]&end_key=[{}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.15",
    "result": {
        "rows": [
            {
                "key": [
                    "69de5836-8fba-43b7-980e-1ad6d0434733"
                ],
                "shortname": "Report date",
                "value": null
            },
            {
                "key": [
                    "f346a8aa-d351-48e7-af5f-cde54493a445"
                ],
                "shortname": "Due date",
                "value": null
            }
        ]
    }
}

datetime_field_definitions_by_search_term_and_id

This view contains all datetime field_definitions for a certain search term by id. Possible search terms are parts of the shortname of the definition card as well as the linked MultiLanguage Card for the label. The value is null.

Example request to find the datetime field definition, which label is linked to the MultiLanguage Card “3370e075-b1b0-4a8f-8b06-de4694481f0b”:

https://example.protogrid.com/api/v2/apps/ppad/views/datetime_field_definitions_by_search_term_and_id?start_key=["3370e075-b1b0-4a8f-8b06-de4694481f0b",null]&end_key=["3370e075-b1b0-4a8f-8b06-de4694481f0b",{}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.15",
    "result": {
        "rows": [
            {
                "key": [
                    "3370e075-b1b0-4a8f-8b06-de4694481f0b",
                    "f346a8aa-d351-48e7-af5f-cde54493a445"
                ],
                "shortname": "Due date",
                "value": null
            }
        ]
    }
}

This view contains all Cards with related keys 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”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/related_keys_by_id?keys=["234486c7-939f-49f4-88b2-6fd51369a1d9"]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.15",
    "result": {
        "rows": [
            {
                "key": "234486c7-939f-49f4-88b2-6fd51369a1d9",
                "shortname": "name",
                "value": [
                    [
                        "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e",
                        "_users"
                    ],
                    [
                        "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e",
                        "_users"
                    ],
                    [
                        "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e",
                        "_users"
                    ],
                    [
                        "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e",
                        "_users"
                    ],
                    [
                        "6ab4c76c-07a3-4edd-99aa-c61923866020",
                        "_users"
                    ],
                    [
                        "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e",
                        "_users"
                    ],
                    [
                        "system_and_support",
                        "_users"
                    ],
                    [
                        "09cfa5cd-d34e-4afc-f548-3903d26e763e",
                        ""
                    ],
                    [
                        "ce074230-da21-4492-e39b-4c64fb74c1b8",
                        ""
                    ]
                ]
            }
        ]
    }
}

by_relating_key

This view contains all Cards with the related key by id. The key is composed of the two card keys. The value is null.

Example request to find all Cards related to the Card “626f04f7-179d-40d7-99f0-9e54343abf98”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/by_relating_key?start_key=["626f04f7-179d-40d7-99f0-9e54343abf98", null]&end_key=["626f04f7-179d-40d7-99f0-9e54343abf98", {}]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.15",
    "result": {
        "rows": [
            {
                "key": [
                    "626f04f7-179d-40d7-99f0-9e54343abf98",
                    "00ded64d-5e1b-42a1-a61e-f8e46c0c552a"
                ],
                "shortname": "Liguan 2.0 TDI",
                "value": null
            },
            {
                "key": [
                    "626f04f7-179d-40d7-99f0-9e54343abf98",
                    "50a9098b-bd4e-47fe-9e99-7d8f1d43517a"
                ],
                "shortname": "Paolo Schnuffi - wishes a callback ",
                "value": null
            },
            {
                "key": [
                    "626f04f7-179d-40d7-99f0-9e54343abf98",
                    "5d068708-9546-4536-94c6-da27b6a909b2"
                ],
                "shortname": "Freddie Mac - wishes a callback  - nightTable 2.0",
                "value": null
            },
            {
                "key": [
                    "626f04f7-179d-40d7-99f0-9e54343abf98",
                    "fa6f178c-a398-4852-a3b3-7e66978c9a65"
                ],
                "shortname": "EcoDischarger",
                "value": null
            },
            {
                "key": [
                    "626f04f7-179d-40d7-99f0-9e54343abf98",
                    "fbf79fc6-2da1-41f2-9954-1606dbe3fa01"
                ],
                "shortname": "Liguan 2.0 TDI",
                "value": null
            }
        ]
    }
}

tableview_data_by_id

This view contains all Cards contained in a tableview by id. The value contains the raw card.

Example request to get card with key “5f12ccf6-9de0-4796-d366-106e4b7b8af9”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/tableview_data_by_id?keys=[["5f12ccf6-9de0-4796-d366-106e4b7b8af9"]]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.15",
    "result": {
        "rows": [
            {
                "key": "5f12ccf6-9de0-4796-d366-106e4b7b8af9",
                "shortname": "Card: 5f12ccf6-9de0-4796-d366-106e4b7b8af9",
                "value": {
                    "#": [
                        "5f12ccf6-9de0-4796-d366-106e4b7b8af9"
                    ],
                    "&&created": [
                        "2016-03-23T13:19:17"
                    ],
                    "&&creator": [
                        "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e",
                        "_users"
                    ],
                    "&&modified": [
                        "2016-03-23T13:38:19"
                    ],
                    "&&modifier": [
                        "a77b8462-ec5f-4b8e-9bc3-29fe8784c69e",
                        "_users"
                    ],
                    "&&proto_key": [
                        "&&multilanguageProto"
                    ],
                    "&&shortname": [
                        {
                            "de": "Card: 5f12ccf6-9de0-4796-d366-106e4b7b8af9",
                            "en": "Card: 5f12ccf6-9de0-4796-d366-106e4b7b8af9"
                        }
                    ],
                    "de": [
                        ""
                    ],
                    "en": [
                        ""
                    ]
                }
            }
        ]
    }
}

shortname_by_language_objects_by_id

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”:

https://example.protogrid.com/api/v2/apps/produktekatalog/views/shortname_by_language_objects_by_id?keys=[["a0e6717f-c613-404a-bc08-a090311c651c"]]

Example response:

{
    "errors": [],
    "protogrid_environment_version": "1.4.15",
    "result": {
        "rows": [
            {
                "key": "a0e6717f-c613-404a-bc08-a090311c651c",
                "shortname": "Priscilla Molesworth - wishes an offer",
                "value": {
                    "de": "Priscilla Molesworth - wishes an offer",
                    "en": "Priscilla Molesworth - wishes an offer"
                }
            }
        ]
    }
}

sums_by_proto_and_design_element

Sums over the values of a field for all Cards of a Proto. Depending on the field type, this uses the following functions:

  1. For number fields it produces the sum of values over the field.
  2. For text fields it produces the word count over all text entries.
  3. For relation fields it produces the number of stored relations.
  4. For date/time fields it produces the number of stored date/time values.

Example Request to count the number of words in all names (field key “816950eb-1b70-41e2-89f5-5400f9636345”) of Proto “Product”(key “12532072-0d76-4457-8cf8-7847d0470738”):

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"]]

Example Response:

{
    "errors": [],
    "protogrid_environment_version": "2.0beta7",
    "result": {
        "rows": [
            {
                "key": [
                    "12532072-0d76-4457-8cf8-7847d0470738",
                    "816950eb-1b70-41e2-89f5-5400f9636345"
                ],
                "value": 21
            }
        ],
        "total_rows": 0
    }
}

sums_by_proto_and_design_element_and_condition

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:

  1. The Proto key
  2. The design element key for the field to sum over
  3. The design element key for the condition field
  4. The conditional value in the field specified in component (3)

Example: What is the sum over all values in the “Total” field in the Proto “Invoice”, given that the relation field “customer” holds the key for “John Smith”?

Depending on the field type, this uses the following functions:

  1. For number fields it produces the sum of values over the field.
  2. For text fields it produces the word count over all text entries.
  3. For relation fields it produces the number of stored relations.
  4. For date/time fields it produces the number of stored date/time values.

Example Request to count the number of words in the names (field key “816950eb-1b70-41e2-89f5-5400f9636345”) of the Proto “Product”(key “12532072-0d76-4457-8cf8-7847d0470738”) where the product group (field key “359a18bf-2fb6-4d6d-afe4-3b6283f35b50”) is furniture (key “fde10c41-7e7c-45a2-bbf3-3065de5e05ad”):

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"]]

Example Response:

{
    "errors": [],
    "protogrid_environment_version": "2.0beta7",
    "result": {
        "rows": [
            {
                "key": [
                    "12532072-0d76-4457-8cf8-7847d0470738",
                    "816950eb-1b70-41e2-89f5-5400f9636345",
                    "359a18bf-2fb6-4d6d-afe4-3b6283f35b50",
                    "fde10c41-7e7c-45a2-bbf3-3065de5e05ad"
                ],
                "value": 5
            }
        ],
        "total_rows": 0
    }
}
Print/export