Making an entry programmatically via the API
An application programming interface (API) is available that programmers to generate log entries from within their programs. For example, the output from an analysis procedure might be sent automatically to the logbook for safekeeping.Overview
Under the hood, programmatic entries to the logbook are made by placing the desired information into an XML file and sending the XML file to the server via an HTTP PUT. By using one of the API libraries below, the programmer does not need to be concerned about the minute details of crafting and validating an XML file of the appropriate format, nor need to know the details of how to PUT it onto the server and interpret server responses. A few key details of the submission process are important to understand however.
- By default, when the API submit() method is called, an attempt will be made to send the XML file immediately to the logbook web server and receive back either a confirmatory lognumber indicating the record was submitted to the database or an explicit error message indicating rejection.
- In order for immediate submission to succeed, the API must have access to a valid logbook SSL client certificate. (See API Authentication)
- If a logbook SSL client certificate is not available or if the server is down or unreachable, the API will attempt to queue the XML of the entry to the filesystem instead. (See Logbook Queue)
- A background process periodically attempts to submit entries it finds in the queue until each of those entries is explicitly accepted or rejected by the server.
Using the API(s)
If you are a programmer interested in using make log entries from one of your applications, please consult the following documentation resources which also contain helpful examples:
Note: If you use the examples in the API documentation as the starting point for your own scripts or programs, you will need to use the following paths below locate the shred libraries.
External (Java) | https://github.com/JeffersonLab/jlog |
---|---|
Accelerator (Java) | /cs/certified/apps/eloglib/java/jlog2.jar |
Computer Center (Java)* | /apps/eloglib/java/jlog2.jar |
Computer Center (C++, Perl, Python)* | /apps/eloglib/lib/rhel-6-ia32/ |
Accelerator (C++, Perl, Python, PHP, Tcl)* | /cs/certified/apps/eloglib/lib/rhel-6-ia32/ |
|