AJAX: Difference between revisions
Jump to navigation
Jump to search
(→jmsg) |
(→jkey) |
||
| Line 17: | Line 17: | ||
= jkey = | = jkey = | ||
TBW | * JSONP: no | ||
* parameters: | |||
** ?odb=<code>ODB path</code> | |||
* returns: | |||
<pre> | |||
if (equal_ustring(getparam("cmd"), "jkey")) { | |||
show_text_header(); | |||
if (isparam("odb") && db_find_key(hDB, 0, getparam("odb"), &hkey) == DB_SUCCESS) { | |||
db_get_key(hDB, hkey, &key); | |||
rsprintf("%s\n", key.name); | |||
rsprintf("TID_%s\n", rpc_tid_name(key.type)); | |||
rsprintf("%d\n", key.num_values); | |||
rsprintf("%d\n", key.item_size); | |||
rsprintf("%d", key.last_written); | |||
} else | |||
rsputs("<DB_NO_KEY>"); | |||
return; | |||
} | |||
</pre> | |||
* example: TBW | |||
= jmsg = | = jmsg = | ||
Revision as of 15:53, 21 August 2013
About
This page will document the MIDAS AJAX functions accessible through special the mhttpd URLs.
jset
TBW
jget
TBW
jcopy
TBW
jkey
- JSONP: no
- parameters:
- ?odb=
ODB path
- ?odb=
- returns:
if (equal_ustring(getparam("cmd"), "jkey")) {
show_text_header();
if (isparam("odb") && db_find_key(hDB, 0, getparam("odb"), &hkey) == DB_SUCCESS) {
db_get_key(hDB, hkey, &key);
rsprintf("%s\n", key.name);
rsprintf("TID_%s\n", rpc_tid_name(key.type));
rsprintf("%d\n", key.num_values);
rsprintf("%d\n", key.item_size);
rsprintf("%d", key.last_written);
} else
rsputs("<DB_NO_KEY>");
return;
}
- example: TBW
jmsg
- JSONP: no
- parameters:
- ?n=
number of messages to return
- ?n=
- returns: output of cm_msg_retrieve()
if (equal_ustring(getparam("cmd"), "jmsg")) {
i = 1;
if (*getparam("n"))
i = atoi(getparam("n"));
show_text_header();
cm_msg_retrieve(i, str, sizeof(str));
rsputs(str);
return;
}
- example: TBW
jgenmsg
- JSONP: no
- parameters:
- ?msg=
message text
- ?msg=
- returns: ???
if (equal_ustring(getparam("cmd"), "jalm")) {
show_text_header();
al_get_alarms(str, sizeof(str));
rsputs(str);
return;
}
- example: TBW
jalm
- JSONP: no
- parameters: no
- returns: text from al_get_alarms()
if (equal_ustring(getparam("cmd"), "jalm")) {
show_text_header();
al_get_alarms(str, sizeof(str));
rsputs(str);
return;
}
- example: TBW