h1. API 0.2 (unstable) {{toc}} The API basically can be accessed through two methods: Either from the user interface of an OpenAtlas application or, if the settings will allow it, from another application. Please also refer to the SwaggerHub documentation: https://app.swaggerhub.com/apis-docs/ctot-nondef/OpenAtlas/0.2 h1. Endpoints h2. Entity/Entities Endpoints These endpoints can provide full information about one or more entities. The output format is the Linked Place Format(LPF). Alternativly there is a simple GeoJSON format and multiple RDFs, derived from the LPF, available. h3. /api/0.2/entity/{id} Retrieves a representations of an entity through the ID. h3. /api/0.2/class/{cidoc_class_code} Retrieves a json with a list of entities based on their CIDOC CRM class code. The outpout contains a results and pagination key. All in OpenAtlas available codes can be found under [[OpenAtlas and CIDOC CRM]]. The result can be filtered, ordered and manipulated through different parameters. By default results are orderd alphabetically and 20 entities are shown. h3. /api/0.2/code/{view_name} Retrieves a json with a list of entities based on their OpenAtlas view name. Available categories can be found at [[OpenAtlas and CIDOC CRM]]. The result can be filtered, ordered and manipulated through different parameters. By default results are orderd alphabetically and 20 entities are shown. h3. /api/0.2/system_class/{system_class} Retrieves a json with a list of entities based on their OpenAtlas system class. Available categories can be found at [[OpenAtlas and CIDOC CRM]]. The result can be filtered, ordered and manipulated through different parameters. By default results are orderd alphabetically and 20 entities are shown. h3. /api/0.2/query/ With the query endpoint, one can combine the three endpoints above in a single query. Each request has to be a new parameter. Possible parameters are: * ?entities={id} * ?classes={cidoc_class_code} %{color:red}deprecated% * ?codes={view_name} %{color:red}deprecated% * ?system_classes={system_class} %{color:red}deprecated% For more details of the different queries please consult the associated section. The result can be filtered, ordered and manipulated through different parameters. By default results are orderd alphabetically and 20 entities are shown. h3. /api/0.2/latest/{1-100} Retrieves the latest entries made in the OpenAtlas database. The number represents the amount of entities retrieved. */latest* can be any number between and including 1 and 100. h3. /api/0.2/entities_linked_to_entity/{id} Retrieves a list of entities, which are linked to the entity with the given *id*. The result can be filtered, ordered and manipulated through different parameters. By default results are orderd alphabetically and 20 entities are shown. h3. /api/0.2/type_entities/{id} Retrieves a list of entities based on their OpenAtlas *type*. A possible *id* can be obtained for example by the type_tree or node_overview endpoint. The result can be filtered, ordered and manipulated through different parameters. By default results are orderd alphabetically and 20 entities are shown. h3. /api/0.2/type_entities_all/{id} Retrieves a list of entities based on their OpenAtlas type. This also includes all entities, which are connected to an subtype. A possible *id* can be obtained for example by the type_tree or node_overview endpoint. The result can be filtered, ordered and manipulated through different parameters. By default results are orderd alphabetically and 20 entities are shown. h2. Nodes Endpoints h3. /api/0.2/node_entities/{id} %{color:red}deprecated% Retrieves a JSON list of entities names, IDs and URLs, based on their OpenAtlas type. Be aware that "Historical Place" and "Administrative Units" cannot be retrieved by this. h3. /api/0.2/node_entities_all/{id} %{color:red}deprecated% Retrieves a JSON list of entities names, IDs and URLs, based on their OpenAtlas type. This also includes all subtypes of the given type id. Be aware that "Historical Place" and "Administrative Units" cannot be retrieved by this. h3. /api/0.2/subunit/{id} %{color:red}deprecated% Retrieves a JSON list of entities names, IDs and URLs, from the first layer of subunits from the given entity ID. h3. /api/0.2/subunit_hierarchy/{id} %{color:red}deprecated% Retrieves a JSON list of entities names, IDs and URLs, of all subunits from the given entity ID. h3. /api/0.2/type_tree/ Retrieves a detailed JSONlist of all OpenAtlas types. This includes also includes a list of childrens of a type h3. /api/0.2/node_overview/ %{color:red}deprecated% Retrieves a JSON list of all OpenAtlas types sorted by *custom*, *places*, *standard* and *value*. h2. Content Endpoints h3. /api/0.2/classes Provides a list of all available system classes, their CIDOC CRM mapping, which view they belong, which icon is used and the English name h3. /api/0.2/content Retrieves a json of the content (Intro, Legal Notice, Contact and the size for processed images) from the OpenAtlas instance. The language can be chosen with the *lang* parameter (en or de). h3. /api/0.2/geometric_entities/ Retrieves a list of all selected geometries in the database in a standard GeoJSON format. This endpoint should be used for map overviews. h3. /api/0.2/system_class_count/ Retrieves a list of how many entities, a system class has. h2. Image Endpoint h3. /api/display/{id} Provides the image of the requested ID. Be aware, the image will only be displayed if: * Request comes from a logged-in user * API public setting is set *on* AND the image has a *Licence* h1. Parameters Not all endpoints support all parameters. Also, some endpoints has additional unique parameter options, which are described at their section. |_.path\parameter |_.type_id|_.format|_.page |_.sort |_.column |_.limit |_.filter |_.first |_.last |_.show |_.count |_.download |_.lang |_.geometry |_.image_size| | entity | | x | | | | | | | | x | | x | | | | | code | x | x | x | x | x | x | x | x | x | x | x | x | | | | | system_class| x | x | x | x | x | x | x | x | x | x | x | x | | | | | entities_linked_to_entity| x | x | x | x | x | x | x | x | x | x | x | x | | | | | type_entities| x | x | x | x | x | x | x | x | x | x | x | x | | | | | type_entities_all| x | x | x | x | x | x | x | x | x | x | x | x | | | | | class | x | x | x | x | x | x | x | x | x | x | x | x | | | | | latest | x | x | x | x | x | x | x | x | x | x | x | x | | | | | query | x | x | x | x | x | x | x | x | x | x | x | x | | | | | node_entities | | | | | | | | | | | x | x | | | | | node_entities_all| | | | | | | | | | | x | x | | | | | subunit | | | | | | | | | | | x | x | | | | | subunit_hierarchy | | | | | | | | | | | x | x | | | | | type_tree| | | | | | | | | | | x | x | | | | | node_overview| | | | | | | | | | | x | x | | | | | geometric_entities| | | | | | | | | | | x | x | | x | | | content| | | | | | | | | | | | x | x | | | | classes| | | | | | | | | | | | | | | | | system_class_count| | | | | | | | | | | | | | | | | display| | | | | | | | | | | | | | | x | h2. Sort
<'asc', 'desc'>
The _sort_ parameter controls the order of the results. These can be either ascending (asc) or descending (desc). To use this feature add the parameter:
?sort=<'asc','desc'>
h3. Validation If multiple _sort_ parameter are used, the first valid sort input will be used. It does not matter if the words are uppercase or lowercase (i.e. DeSc or aSC), but the query only takes *asc* or *desc* as valid input. If no valid input is provided, the result is orders ASC. h2. Column
<'id', 'class_code', 'name', 'description', 'created', 'modified', 'system_type', 'begin_from', 'begin_to', 'end_from', 'end_to'>
The _column_ parameter declares which columns in the table are sorted with the _sort_ parameter.
?column=<'id', 'class_code', 'name', 'description', 'created', 'modified', 'system_type', 'begin_from', 'begin_to', 'end_from', 'end_to'>
h3. Validation If multiple _column_ parameter are used, a list is created, by the order in which the parameters are given (i.e. ?column=name&column=description&column=id will order by name, description and id). It does not matter if the words are uppercase or lowercase (i.e. Name, ID, DeScrIPtioN or Class_Code). If no valid input is provided, the results are ordered by name. h2. Limit

The _limit_ parameter declares how many results will returned.
?limit=
h3. Validation If multiple _limit_ parameter are used, the first valid _limit_ input will be used. Limit only take positive numbers. h2. Filtering %{color:red}deprecated%
<=, !=, <, <=, >, >=, LIKE, IN, AND, OR, AND NOT, OR NOT>
The _filter_ parameter is used to specify which entries should return.
?filter=
h3. Validation _Filter_ takes a lot of different parameters in various forms. _Filter_ values need to be separated by |. # First value has to be a concatenation operator: 'and': 'AND', 'or': 'OR', 'onot': 'OR NOT', 'anot': 'AND NOT'. # Second value has to be the effected column: 'id', 'class_code', 'name', 'description', 'created', 'modified', 'system_type', 'begin_from', 'begin_to', 'end_from', 'end_to'. # Third value has to be a logical operator: 'eq': '=', 'ne': '!=', 'lt': '<', 'le': '<=', 'gt': '>', 'ge': '>=', 'like': 'LIKE', # Fourth value has to be the search term. If the 'in' operator is selected, then the search term has to be in brackets and separated by commas. Please note, that the filter values will translate directly in SQL. For example:
?filter=and|name|like|Ach&filter=or|id|gt|5432
will result in

AND e.name LIKE %%Ach%% OR e.id > 5432
?filter=or|id|gt|150&filter=anot|id|ne|200 
?filter=and|name|like|Ach
h2. Pagination (page / first / last)
first= OR last= OR page=
The _page_ parameter will take any number as page number and provides the entities of this page. The _first_ parameter takes IDs and will show every entity after and including the named ID. The _last_ parameter takes IDs and will show every entity after the named ID.
?page=
?first=
?last=
h3. Validation _Page_, _first_ and _last_ will only take *numbers*. _First_ and _last_ has to be a valid ID. The table will be sorted AND filtered before the pagination comes in place.
?page=4
?last=220
?first=219
h2. Show/Hide Types
<'when', 'types', 'relations', 'names', 'links', 'geometry', 'depictions', 'none'>
The _show_ parameter will take in the key values of a json. If no value is given, every key will be filled. If a value is given, it only will show the types which are committed. If the parameter contains _none_, no additional keys/values will be shown. This will only work with the Linked Places Format.
?show=<'when', 'types', 'relations', 'names', 'links', 'geometry', 'depictions', 'none'>
h3. Validation For each value, a new parameter has to be set. The value will be matched against a list of keywords, so wrong input will be ignored.
?show=when
?show=types
?show=types&show=when
?show=none
h2. Format
lp, geojson, pretty-xml, n3, turtle, nt, xml
With the _format_ parameter, the output format of an entity representation can be selected. _lp_ stands for Linked Places Format, which is the standard selection. For information on other formats, please confer [[API Output Formats]]
?format=
h3. Validation Only the last _format_ parameter counts as valid input. This parameter is not case-sensitive.
?format=lp
?format=geojson
?show=n3
h2. Type ID

The whole search query will be filtered by this Type ID. Multiple _type_id_ parameters are valid and are connected with a logical OR connection.
?type_id=
h3. Validation _type_id_ only takes a valid type ID.
?type_id=
h2. Count
<>
Returns a json with a number of the total count of the included entities.
?count
h3. Validation Only _count_ will trigger the function. Count can have any numbers assigned to it, which makes no difference.
?count
h2. Download
<>
Will trigger the download of the result of the request path.
?download
h3. Validation Only _download_ will trigger the function. Download can have anything assigned to it, but this will be discarded.
?download
h2. Lang (Language)
<'en', 'de'>
Select the language, which content will be displayed.
?lang
h3. Validation Default value is None, which means the default language of the OpenAtlas instance is taken.
?lang
?lang=en
?lang=DE
h2. Geometry
   gisAll, gisPointAll, gisPointSupers, gisPointSubs, gisPointSibling, gisLineAll, gisPolygonAll
Filter, which geometric entities will be retrieved through /geometric_entities. Multiple _geometry_ parameters are valid. Be aware, this parameter is case-sensitive!
?geometry
h3. Validation The default value is _gisAll_. Be aware, this parameter is case-sensitive!
?geometry=gisPointSupers
?geometry=gisPolygonAll