====== WebVIS API ====== The logstar API offers you the possibility to request your data via https directly from the database as a json request. ===== Basics ===== To be able to use the API, you must have the operator generate an ApiKey once, then you can call up the ApiKey at any time in your backend and/or set it again. An API key is tied to an account. If multiple users share an account, they must be informed when a new API key is generated. Therefore, never generate a new API key without careful consideration. ===== URL scheme Retrieval of a station and its data ===== https://logstar-online.de/api/{apiKey}/{Stationname}/{StartDay}/{EndDay}/{Channellist}/{DateTime}/{GeoData} Mandatory parameters: * **apiKey**: This can be found in your backend under 'Manage account' → 'DB Api-Key'. The apiKey is identical for all users and for all stations. * **Stationname**: Name of the station as displayed in the backend section 'Manage projects'. * **StartDay**: Day from which the data should be retrieved in the format: YYYY-MM-DD * **EndDay**: Day to which the data is to be retrieved in the format: YYYY-MM-DD Optional parameters: * **Channellist**: Comma-separated list of the channels to be fetched: e.g. 1,6,12,34. To fetch all channels, the parameter "all" can be set instead of a list of channel numbers. * **DateTime - Date and time format in the channel list**: integer: 0/1 * 0 (default): "dateTime": "2020-04-01 00:00:00" * 1: "date": "2020-04-01", "time": "00:00:00" * **GeoData**: Bool: 0/1 - Returns longitude and latitude of the station as well as a comment * **MetaTags**: Shows all metadata for the station and the channels. Metadata can be stored in the file stationname.inf under the keyword API_Channel_Meta_Data for each channel. Further metadata of the station can be stored in the section [Station_Meta_Data]. In addition, the entries of the WebVIS filters of the station overview are output. In order to use the optional parameters, they must be named in a fixed order. Optional parameters at the end may remain free, e.g.\\ Retrieval of all channels with date and time format separated:\\ https://logstar-online.de/api/{apiKey}/{Stationname}/{StartDay}/{EndDay}/0/1 Retrieval of specific channels with geodata:\\ https://logstar-online.de/api/{apiKey}/{Stationname}/{StartDay}/{EndDay}/2,5,8/0/1 Retrieval of specific channels with geodata and meta data:\\ https://logstar-online.de/api/{apiKey}/{Stationname}/{StartDay}/{EndDay}/2,5,8/0/1/1 ===== URL scheme Retrieval of all stations and their data ===== https://logstar-online.de/api/{apiKey}/all-stations/{DayTag}/0 Mandatory parameters: * **apiKey**: This can be found in your backend under 'Manage account' → 'DB Api-Key'. The apiKey is identical for all users and for all stations. * **StartDay**: Day from which the data should be retrieved in the format: YYYY-MM-DD * **EndDay**: 0 Optional parameters: * **MetaData**: 1 - URL scheme for retrieving all stations including their metadata: https://logstar-online.de/api/{apiKey}/all-stations/{StartDay}/0/0/0/0/1 With the keyword "**all-stations**" you can retrieve all your stations. As a return you will receive a json-request in the form: "station_name": { "last_data_entry": "2023-06-13 19:30:00", "location_name": { "name assigned by them", "station_geo_location": { "latitude": "58.656437", "longitude": "23.609131", "location_comment": "Comment assigned by them" }, "stationInfo": { "data": "Filter Data", "project": "Filter Project", "individual": "individual filter" } }, ===== Error messages ===== Error messages are also returned as json response in the form: ''{"error":"Start date is earlier than end date "}''