Project

General

Profile

Actions

API 0.3 (stable)

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.

Endpoints

Entity/Entities Endpoints

These endpoints can provide full information about one or more entities. The output format is the Linked Place Format(LPF). Alternatively, there is a simple GeoJSON format and multiple RDFs, derived from the LPF, available.

/api/0.3/entity/{id}

Retrieves a representation of an entity through the ID.

/api/0.3/cidoc_class/{cidoc_class_code}

Retrieves a json with a list of entities based on their CIDOC CRM class code. The output 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 ordered alphabetically, and 20 entities are shown.

/api/0.3/view_class/{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 ordered alphabetically and 20 entities are shown.

/api/0.3/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 ordered alphabetically and 20 entities are shown.

/api/0.3/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}
  • ?cidoc_classes={cidoc_class_code}
  • ?view_classes={view_name}
  • ?system_classes={system_class}

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 ordered alphabetically, and 20 entities are shown.

/api/0.3/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.

/api/0.3/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 ordered alphabetically and 20 entities are shown.

/api/0.3/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 ordered alphabetically and 20 entities are shown.

/api/0.3/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 ordered alphabetically, and 20 entities are shown.

Type Endpoints

/api/0.3/type_tree/

Retrieves a detailed JSON list of all OpenAtlas types. This includes also includes a list of children of a type

/api/0.3/type_overview/

Retrieves a JSON list of all OpenAtlas types sorted by custom, places, standard and value.

Subunit Endpoints

/api/0.3/subunits/{id}

Takes only a valid place (E18) ID. Retrieves a list of the given place and all of its subunits. This endpoint provides a special Thanados Format. With the format=xml parameter, an XML can be created,

Content Endpoints

/api/0.3/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

/api/0.3/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).

/api/0.3/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.

/api/0.3/system_class_count/

Retrieves a list of how many entities, a system class has.

Image Endpoint

/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

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 search first last show count download lang geometry image_size export
entity x x x x
code x 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 x
entities_linked_to_entity x 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 x
type_entities_all x 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 x
latest x 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 x
type_entities x x x
type_entities_all x 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

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'>

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.

Column

<'id', 'name', 'cidoc_class', 'system_class'>

The column parameter declares which columns in the table are sorted with the sort parameter.

?column=<'id', 'name', 'cidoc_class', 'system_class'>

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=id will order by name and then by 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.

Limit

<number>

The limit parameter declares how many results will return. limit=0 will return all entities.

?limit=<number>

Validation

If multiple limit parameter are used, the first valid limit input will be used. Limit only take positive numbers.

Search

The search parameter provides a tool to filter and search the data with logical operators.

Search parameter:

?search={}

Logical operators:
These are not mandatory. _or _ is the standard value.

 and, or 

Compare operators:

equal, notEqual, like(1), greaterThan(2), greaterThanEqual(2), lesserThan(2), lesserThanEqual(2)
(1) Only string categories
(2) Only beginFrom, beginTo, endFrom, endTo, valueTypeID

Filterable categories:

entityName, entityDescription, entityAliases, entityCidocClass, entitySystemClass, entityID, typeID, valueTypeID, typeIDWithSubs, typeName, beginFrom, beginTo, endFrom, endTo, relationToID

Usage

The search parameter takes a JSON as value. A key has to be a filterable category followed by a list/array. This list need to have again JSON values as items. There can be multiple search parameters. E.g:

?search={"typeID":[{"operator":"equal","values":[123456]}], "typeName":[{"operator":"like","values":["Chain", "Bracelet", "Amule"],"logicalOperator":"and"}]}&search={"typeName":[{"operator":"equal","values":["Gold"]}], "beginFrom":[{"operator":"lesserThan","values":["0850-05-12"],"logicalOperator":"and"}]}

Logical connections

Every JSON in a search parameter field is logical connected with AND. E.g:

?search={A:[{X}, {Y}], B: [M]} => Entities containing A(X and Y) and B(M) 

Each search parameter is logical connected with OR. E.g:

?search={A:[{X}, {Y}]}&search={A:[{M}]} => Entities containing A(X and Y) or A(M)

Queries

Within the list of a key, there are multiple queries possible. A query contains a compare operator, the values to be searched and a logical operator, how the values should be handled. E.g:

{"operator":"equal","values":[123456],"logicalOperator":"or"}
{"operator":"notEqual","values":["string", "otherString"],"logicalOperator":"and"}
{"operator":"lesserThan","values":["0850-05-12"],"logicalOperator":"and"}
{"operator":"like","values":["Gol", "Amul"],"logicalOperator":"and"}

values

Values has to be a list of items. The items can be either a string, an integer or a tuple (see Note). Strings need to be marked with "" or '', while integers doesn't allow this.

Note: the category valueTypeID can search for values of a type ID. But it takes one or more two valued Tuple as list entry: (x,y). x is the type id and y is the searched value. This can be an int or a float. E.g:

{"operator":"lesserThan","values":[(3142,543.3)],"logicalOperator":"and"}

Compare operators

The compare operators work like the mathematical operators. equal x=y, notEqual x!=y, greaterThan x>y , greaterThanEqual x>=y, lesserThan x<y, lesserThanEqual x<=y. The like operator searches for occurrence of the string, so a match can also occur in the middle of a word.

Explained Example:

With the example above, we can textualize the outcome:

?search={"typeID":[{"operator":"equal","values":[123456],"logicalOperator":"or"}, "typeName":[{"operator":"notEqual","values":["Chain", "Burial object"],"logicalOperator":"and"]}&search={"typeName":[{"operator":"like","values":["Gol"],"logicalOperator":"or"}]}

Get entities which has the typeID 123456 AND NOT the types called "Chain" AND "Burial object", OR all entities which has the typeName with "Gold" in the type name.

Pagination (page / first / last)

first=<id> OR last=<id> OR page=<int>

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=<int>

?first=<id>

?last=<id>

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

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'>

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

Show/Hide Relations by Property Code

<'P2', 'P67', 'P53', 'OA7', ...>

The relation_type parameter will take the property code from CIDOC CRM (P) and the OpenAtlas codes (OA) as values. The relation json field from the Linked Places Format will only show relations with the given code. This can significantly decrease the payload.

Validation

For each value, a new parameter has to be set. The value will be matched against the list of possible property codes. Wrong input will be ignored.

?relation_type=P2
?relation_type=P67
?relation_type=2&relation_type=OA7

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=<lp, geojson, pretty-xml, n3, turtle, nt, xml>

Validation

Only the last format parameter counts as valid input. This parameter is not case-sensitive.

?format=lp
?format=geojson
?show=n3

Type ID

<int>

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=<id>

Validation

type_id only takes a valid type ID.

?type_id=<int>

Count

<>

Returns a json with a number of the total count of the included entities.

?count

Validation

Only count will trigger the function. Count can have any numbers assigned to it, which makes no difference.

?count

Download

<>

Will trigger the download of the result of the request path.

?download

Validation

Only download will trigger the function. Download can have anything assigned to it, but this will be discarded.

?download

Lang (Language)

<'en', 'de'>

Select the language, which content will be displayed.

?lang

Validation

Default value is None, which means the default language of the OpenAtlas instance is taken.

?lang
?lang=en
?lang=DE

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

Validation

The default value is gisAll. Be aware, this parameter is case-sensitive!

?geometry=gisPointSupers
?geometry=gisPolygonAll

Export

   csv, csvNetwork

Export the result in the given format as download. csv is one single CSV file of the result. csvNetwork are multiple CSV files, especially used for network analysis. So there are for each system class a CSV, describing the entities, a link.csv where the links between the entities are shown and a geometry.csv containing the geometries.

?export

Validation

?export=csv
?export=csvNetwork

Updated by Bernhard Koschiček-Krombholz over 2 years ago · 33 revisions

Also available in: PDF HTML TXT