Item #
These requests are aimed at working with items. Since elements are contained in items, deleting item request leads to removing elements and their data too.
There are four item requests:
item/add #
Request for adding a new item to the application.
Request #
| Request Method | Content Type | Request URL |
|---|---|---|
POST |
Form Data |
https://gudhub.com/GudHub/api/items/add |
It contains an array of items with added data, application ID, and token.
| Name | Type | Description |
|---|---|---|
| token | string |
using for getting access |
| app_id | object |
unique application ID |
| items | array |
array of added data |
Example:
items:[{
"item_id":0,
"fields":[]
}]
app_id: 3733
token:
beyewulqzxnbd.tifrvcgdulrnmovvasdyizwbdjykn
Response #
In return will be an array of item objects.
[{
"item_id":81907,
"index_number":8,
"last_update":1502099832000,
"fields":[{ }]
}]
Status Code #
| Name | Description |
|---|---|
| 200 Ok | item is added |
| 710 | user have no right to add items |
item/update #
Request for data updating in the existed item.
Request #
| Request Method | Content Type | Request URL |
|---|---|---|
POST |
Form Data |
https://gudhub.com/GudHub/api/items/update |
It contains an array of updated items, application ID, and token.
| Name | Type | Description |
|---|---|---|
| token | string |
using for getting access |
| app_id | number |
contains ID of the application whose items will be updated |
| items | array |
contains items with updated data |
Example:
items:[{
"item_id":"81905",
"fields":[{
"field_id":"42530",
"field_value":"test"
}]
}]
app_id: 3733
token:beyewulqzxnbd.tifrvcgdulrnmovvasdyizwbdjykn
Response #
As a result, we will see updated file information.
{
"item_id":81905,
"index_number":6,
"last_update":1502099396000,
"fields":[{
"field_id":42530,
"field_value":"test",
"data_id":467973
}]
}
Status Code #
| Name | Description |
|---|---|
| 000 Unupdate | wrong properties (expansion, size, ...) |
| 200 Ok | item is updated |
| 710 | user have no right to update items |
item/delete #
Request for deleting an item. When we do it all documents in item will be deleted too.
Request #
| Request Method | Content Type | Request URL |
|---|---|---|
POST |
Form Data |
https://gudhub.com/GudHub/api/items/delete |
It contains an array of item IDs and token.
| Name | Type | Description |
|---|---|---|
| items_ids | array |
array of deleted data |
Example:
items_ids: [81904]
token:beyewulqzxnbd.tifrvcgdulrnmovvasdyizwbdjykn
Response #
In response, you will receive all the updated items.
[{
"fields": [{
"field_id": 684731,
"element_id": 684731,
"field_value": "1659365564518",
"data_id": 23432835
}],
"index_number": 6,
"item_id": 81904,
"last_update": 1659508824000
}]
Status Code #
| Name | Description |
|---|---|
| 200 Ok | item/items with specified ID is deleted |
| 710 | user have no right to delete items |
item/get #
Request for getting items of the application, optionally filtered by field values.
Request #
| Request Method | Content Type | Request URL |
|---|---|---|
POST |
Form Data |
https://gudhub.com/GudHub/api/items/get |
It contains the application ID, token, and optional pagination and filtering parameters.
| Name | Type | Description |
|---|---|---|
| token | string |
using for getting access |
| app_id | number |
unique application ID |
| offset | number |
optional, number of items to skip, used for pagination (default 0) |
| limit_to | number |
optional, maximum number of items to return; 0 means no limit (default 0) |
| filter_list | array |
optional, array of filter objects used to filter the returned items (JSON-stringified) |
| items_list | array |
optional, array of specific item IDs to fetch (JSON-stringified) |
Each object in filter_list describes a single condition:
| Property | Type | Description |
|---|---|---|
| field_id | number |
ID of the field the filter is applied to |
| data_type | string |
type of the field's data, e.g. text, number, date, phone, gps_coords |
| boolean_strategy | string |
how multiple filters are combined, e.g. and |
| valuesArray | array |
array of strings with the values/search terms to filter by |
| search_type | string |
comparison to apply: equal_and, equal_or, not_equal_and, not_equal_or, contain_and, contain_or, not_contain_and, not_contain_or, bigger, lower, range, value, phone_equal_or, distance, date_in, date_out, recurring_date |
| selected_search_option_variable | string |
search option variable, e.g. Value |
Example:
app_id: 3733
offset: 0
limit_to: 0
filter_list: [{
"field_id": 42530,
"data_type": "text",
"boolean_strategy": "and",
"valuesArray": ["John", "Tom"],
"search_type": "equal_and",
"selected_search_option_variable": "Value"
}]
token:
beyewulqzxnbd.tifrvcgdulrnmovvasdyizwbdjykn
Response #
In return will be an array of item objects matching the filter (or all items, if no filter was passed).
[{
"item_id":81905,
"index_number":6,
"last_update":1502099396000,
"fields":[{
"field_id":42530,
"field_value":"John",
"data_id":467973
}]
}]
Status Code #
| Name | Description |
|---|---|
| 200 Ok | items received |
| 710 | user have no right to view items |