diff --git a/.gitignore b/.gitignore index d7b3982..d741a5d 100644 --- a/.gitignore +++ b/.gitignore @@ -142,3 +142,4 @@ checklink/cookies.txt .gitconfig *.sqlite +omeka_s_tools.code-workspace diff --git a/api.ipynb b/api.ipynb index 632204a..959cf1d 100644 --- a/api.ipynb +++ b/api.ipynb @@ -340,6 +340,10 @@ " '''\n", " if template_id:\n", " payload['o:resource_template'] = self.format_resource_id(template_id, 'resource_templates')\n", + " # If class is not set explicitly, use class associated with template\n", + " if not class_id:\n", + " template = self.get_resource_by_id(template_id, 'resource_templates')\n", + " class_id = template['o:resource_class']['o:id']\n", " if class_id:\n", " payload['o:resource_class'] = self.format_resource_id(class_id, 'resource_classes')\n", " if item_set_id:\n", @@ -484,38 +488,47 @@ " response = self.s.put(f'{self.api_url}/{resource_type}/{payload[\"o:id\"]}', json=payload, params=self.params)\n", " return response.json()\n", " \n", - " def add_media_to_item(self, item_id, media_file):\n", + " def add_media_to_item(self, item_id, media_file, payload={}, template_id=None, class_id=None):\n", " '''\n", " Upload a media file and associate it with an existing item.\n", " \n", " Parameters:\n", " * `item_id` - the Omeka id of the item this media file should be added to\n", - " * `media_file` - the media file to be uploaded, c\n", - " \n", - " The value of `media_file` can be either:\n", - " * a path to an image/media file (filename is used as title)\n", - " * a dict containing `title` and `path` values\n", - " \n", - " The path values can either be strings or pathlib Paths.\n", + " * `media_path` - a path to an image/media file (string or pathlib Path)\n", + " * `payload` (optional) - metadata to attach to media object, either \n", + " a dict generated by `prepare_item_payload()` or `prepare_item_payload_using_template()`,\n", + " or a string which is used as the value for `dcterms:title`.\n", + " * `template_id` - internal Omeka identifier of a resource template you want to attach to this item\n", + " * `class_id` - internal Omeka identifier of a resource class you want to attach to this item\n", " \n", " Returns: \n", " * a dict providing a JSON-LD representation of the new media object\n", " '''\n", " files = {}\n", + " # For backwards compatibility\n", " if isinstance(media_file, dict):\n", - " title = media_file['title']\n", - " path = Path(media_file['path'])\n", - " else:\n", - " path = Path(media_file)\n", - " title = path.name\n", + " path = media_file['path']\n", + " payload = media_file['title']\n", + " # Make sure path is a Path object\n", + " path = Path(media_file)\n", + " if isinstance(payload, str):\n", + " payload = self.prepare_item_payload({'dcterms:title': [payload]})\n", + " if template_id:\n", + " payload['o:resource_template'] = self.format_resource_id(template_id, 'resource_templates')\n", + " if not class_id:\n", + " template = self.get_resource_by_id(template_id, 'resource_templates')\n", + " class_id = template['o:resource_class']['o:id']\n", + " if class_id:\n", + " payload['o:resource_class'] = self.format_resource_id(class_id, 'resource_classes')\n", " file_data = {\n", " 'o:ingester': 'upload', \n", " 'file_index': '0',\n", + " 'o:source': path.name,\n", " 'o:item': {'o:id': item_id},\n", - " 'dcterms:title': [{'property_id': 1, '@value': title, 'type': 'literal'}]\n", " }\n", + " payload.update(file_data)\n", " files[f'file[0]'] = path.read_bytes()\n", - " files['data'] = (None, json.dumps(file_data), 'application/json')\n", + " files['data'] = (None, json.dumps(payload), 'application/json')\n", " response = self.s.post(f'{self.api_url}/media', files=files, params=self.params)\n", " return response.json()\n", " \n", @@ -750,7 +763,7 @@ { "data": { "text/markdown": [ - "
OmekaAPIClient.get_resources
[source]OmekaAPIClient.get_resources
[source]OmekaAPIClient.get_resources
(**`resource_type`**, **\\*\\*`kwargs`**)\n",
"\n",
@@ -786,7 +799,7 @@
{
"data": {
"text/plain": [
- "87"
+ "101"
]
},
"execution_count": null,
@@ -828,7 +841,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.get_resource_by_id
[source]OmekaAPIClient.get_resource_by_id
[source]OmekaAPIClient.get_resource_by_id
(**`resource_id`**, **`resource_type`**=*`'items'`*)\n",
"\n",
@@ -886,7 +899,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.get_template_by_label
[source]OmekaAPIClient.get_template_by_label
[source]OmekaAPIClient.get_template_by_label
(**`label`**)\n",
"\n",
@@ -947,7 +960,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.get_resource_by_term
[source]OmekaAPIClient.get_resource_by_term
[source]OmekaAPIClient.get_resource_by_term
(**`term`**, **`resource_type`**=*`'properties'`*)\n",
"\n",
@@ -1019,7 +1032,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.get_resource_from_vocab
[source]OmekaAPIClient.get_resource_from_vocab
[source]OmekaAPIClient.get_resource_from_vocab
(**`local_name`**, **`vocabulary_namespace_uri`**=*`'http://schema.org/'`*, **`resource_type`**=*`'properties'`*)\n",
"\n",
@@ -1098,7 +1111,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.get_property_id
[source]OmekaAPIClient.get_property_id
[source]OmekaAPIClient.get_property_id
(**`term`**)\n",
"\n",
@@ -1163,7 +1176,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.filter_items_by_property
[source]OmekaAPIClient.filter_items_by_property
[source]OmekaAPIClient.filter_items_by_property
(**`filter_property`**=*`'schema:name'`*, **`filter_value`**=*`''`*, **`filter_type`**=*`'eq'`*, **`page`**=*`1`*, **\\*\\*`extra_filters`**)\n",
"\n",
@@ -1204,10 +1217,30 @@
"metadata": {},
"outputs": [],
"source": [
- "items = omeka.filter_items_by_property(filter_property='schema:name', filter_value='WRAGGE.')\n",
+ "items = omeka.filter_items_by_property(filter_property='schema:name', filter_value='wragge', filter_type='in')\n",
"\n",
"assert len(items['results']) > 0\n",
- "assert items['results'][0]['schema:name'][0]['@value'] == 'WRAGGE.'"
+ "assert 'wragge' in items['results'][0]['schema:name'][0]['@value'].lower()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "'Clement Wragge at Home. - UPDATED!'"
+ ]
+ },
+ "execution_count": null,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "items['results'][0]['schema:name'][0]['@value']"
]
},
{
@@ -1218,7 +1251,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.search_items
[source]OmekaAPIClient.search_items
[source]OmekaAPIClient.search_items
(**`query`**, **`search_type`**=*`'fulltext_search'`*, **`page`**=*`1`*, **\\*\\*`extra_filters`**)\n",
"\n",
@@ -1326,7 +1359,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.prepare_item_payload
[source]OmekaAPIClient.prepare_item_payload
[source]OmekaAPIClient.prepare_item_payload
(**`terms`**)\n",
"\n",
@@ -1423,7 +1456,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.prepare_item_payload_using_template
[source]OmekaAPIClient.prepare_item_payload_using_template
[source]OmekaAPIClient.prepare_item_payload_using_template
(**`terms`**, **`template_id`**)\n",
"\n",
@@ -1515,7 +1548,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.add_media_to_payload
[source]OmekaAPIClient.add_media_to_payload
[source]OmekaAPIClient.add_media_to_payload
(**`payload`**, **`media_files`**)\n",
"\n",
@@ -1579,7 +1612,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.add_item
[source]OmekaAPIClient.add_item
[source]OmekaAPIClient.add_item
(**`payload`**, **`media_files`**=*`None`*, **`template_id`**=*`None`*, **`class_id`**=*`None`*, **`item_set_id`**=*`None`*)\n",
"\n",
@@ -1623,9 +1656,9 @@
"data": {
"text/plain": [
"{'@context': 'https://timsherratt.org/collections/api-context',\n",
- " '@id': 'https://timsherratt.org/collections/api/items/896',\n",
+ " '@id': 'https://timsherratt.org/collections/api/items/992',\n",
" '@type': 'o:Item',\n",
- " 'o:id': 896,\n",
+ " 'o:id': 992,\n",
" 'o:is_public': True,\n",
" 'o:owner': {'@id': 'https://timsherratt.org/collections/api/users/1',\n",
" 'o:id': 1},\n",
@@ -1634,9 +1667,9 @@
" 'o:thumbnail': None,\n",
" 'o:title': 'My first resource!',\n",
" 'thumbnail_display_urls': {'large': None, 'medium': None, 'square': None},\n",
- " 'o:created': {'@value': '2022-02-14T10:39:11+00:00',\n",
+ " 'o:created': {'@value': '2022-04-03T06:43:24+00:00',\n",
" '@type': 'http://www.w3.org/2001/XMLSchema#dateTime'},\n",
- " 'o:modified': {'@value': '2022-02-14T10:39:11+00:00',\n",
+ " 'o:modified': {'@value': '2022-04-03T06:43:24+00:00',\n",
" '@type': 'http://www.w3.org/2001/XMLSchema#dateTime'},\n",
" 'o:media': [],\n",
" 'o:item_set': [],\n",
@@ -1707,7 +1740,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.delete_resource
[source]OmekaAPIClient.delete_resource
[source]OmekaAPIClient.delete_resource
(**`resource_id`**, **`resource_type`**)\n",
"\n",
@@ -1762,7 +1795,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.update_resource
[source]OmekaAPIClient.update_resource
[source]OmekaAPIClient.update_resource
(**`payload`**, **`resource_type`**=*`'items'`*)\n",
"\n",
@@ -1796,7 +1829,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "ARCHITECT of TWO EPOCHS TRAVELS OF INIGO JONES - UPDATED!\n"
+ "The Courier-Mail (Brisbane, Qld. : 1933 - 1954) - UPDATED!\n"
]
}
],
@@ -1833,21 +1866,20 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.add_media_to_item
[source]OmekaAPIClient.add_media_to_item
[source]OmekaAPIClient.add_media_to_item
(**`item_id`**, **`media_file`**)\n",
+ "> OmekaAPIClient.add_media_to_item
(**`item_id`**, **`media_file`**, **`payload`**=*`{}`*, **`template_id`**=*`None`*, **`class_id`**=*`None`*)\n",
"\n",
"Upload a media file and associate it with an existing item.\n",
"\n",
"Parameters:\n",
"* `item_id` - the Omeka id of the item this media file should be added to\n",
- "* `media_file` - the media file to be uploaded, c\n",
- "\n",
- "The value of `media_file` can be either:\n",
- "* a path to an image/media file (filename is used as title)\n",
- "* a dict containing `title` and `path` values\n",
- "\n",
- "The path values can either be strings or pathlib Paths.\n",
+ "* `media_path` - a path to an image/media file (string or pathlib Path)\n",
+ "* `payload` (optional) - metadata to attach to media object, either \n",
+ " a dict generated by `prepare_item_payload()` or `prepare_item_payload_using_template()`,\n",
+ " or a string which is used as the value for `dcterms:title`.\n",
+ "* `template_id` - internal Omeka identifier of a resource template you want to attach to this item\n",
+ "* `class_id` - internal Omeka identifier of a resource class you want to attach to this item\n",
"\n",
"Returns: \n",
"* a dict providing a JSON-LD representation of the new media object"
@@ -1864,6 +1896,26 @@
"show_doc(OmekaAPIClient.add_media_to_item)"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "omeka_auth = OmekaAPIClient(\n",
+ " api_url='https://timsherratt.org/collections/api',\n",
+ " key_identity=os.getenv('KEY_IDENTITY'), \n",
+ " key_credential=os.getenv('KEY_CREDENTIAL')\n",
+ ")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Add a media file to an item without any additional metadata."
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1876,7 +1928,7 @@
"item_id = item['o:id']\n",
"\n",
"# Add a new media file to the item\n",
- "media_resource = omeka_auth.add_media_to_item(item_id, media_file='media/nla.news-article226799674-24144902.jpg')\n",
+ "media_resource = omeka_auth.add_media_to_item(item_id, 'media/nla.news-article226799674-24144902.jpg')\n",
"\n",
"# Check that the media resource is the expected type\n",
"assert media_resource['@type'] == 'o:Media'\n",
@@ -1885,6 +1937,79 @@
"assert media_resource['o:item']['o:id'] == item_id"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Include a title for a new media item by supplying a string value to the `payload` parameter."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Add a new media file with a title to the item\n",
+ "media_resource = omeka_auth.add_media_to_item(item_id, 'media/nla.news-article226799674-24144902.jpg', payload='This has a title')\n",
+ "\n",
+ "# The title should be saved as dcterms:title\n",
+ "assert media_resource['dcterms:title'][0]['@value'] == 'This has a title'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Include more detailed metadata with a new media item by generating a payload and supplying it using the `payload` parameter."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Define some metadata\n",
+ "media_metadata = {\n",
+ " 'schema:name': ['This is a different title'],\n",
+ " 'schema:identifier': ['myidis3']\n",
+ "}\n",
+ "\n",
+ "# Convert metadata into an Omeka payload\n",
+ "media_payload = omeka_auth.prepare_item_payload(media_metadata)\n",
+ "\n",
+ "# Add a new media file with a metadata payload to the item\n",
+ "media_resource = omeka_auth.add_media_to_item(item_id, 'media/nla.news-article226799674-24144902.jpg', payload=media_payload)\n",
+ "\n",
+ "assert media_resource['schema:name'][0]['@value'] == 'This is a different title'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Use a specific resource template with the new media item by using the `template_id` parameter."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Get a random template from a list of available templates for testing\n",
+ "data = omeka_auth.get_resources('resource_templates')\n",
+ "template = random.choice(data['results'])\n",
+ "template_id = template['o:id']\n",
+ "\n",
+ "# Add a new media file and assign it to a template using the `template_id` parameter\n",
+ "media_resource = omeka_auth.add_media_to_item(item_id, 'media/nla.news-article226799674-24144902.jpg', payload=media_payload, template_id=template_id)\n",
+ "\n",
+ "# Check the new media object has the correct template id\n",
+ "assert media_resource['o:resource_template']['o:id'] == template_id"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1893,7 +2018,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.add_marker_to_item
[source]OmekaAPIClient.add_marker_to_item
[source]OmekaAPIClient.add_marker_to_item
(**`item_id`**, **`coords`**=*`None`*, **`terms`**=*`None`*, **`label`**=*`None`*, **`media_id`**=*`None`*)\n",
"\n",
@@ -2031,7 +2156,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.prepare_template_payload
[source]OmekaAPIClient.prepare_template_payload
[source]OmekaAPIClient.prepare_template_payload
(**`template_file`**)\n",
"\n",
@@ -2092,14 +2217,14 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.upload_template
[source]OmekaAPIClient.upload_template
[source]OmekaAPIClient.upload_template
(**`template_file`**)\n",
+ "> OmekaAPIClient.upload_template
(**`template_payload`**)\n",
"\n",
"Upload a template exported from an instance of Omeka to the current local instance.\n",
"\n",
"Parameters:\n",
- "* `template_file` - path to a template exported from Omeka (str or pathlib Path)\n",
+ "* `template_payload` - dict payload generated by `prepare_template_payload`\n",
"\n",
"Return:\n",
"* dict containing a JSON-LD representation of the uploaded template"
@@ -2152,7 +2277,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.localise_custom_vocabs
[source]OmekaAPIClient.localise_custom_vocabs
[source]OmekaAPIClient.localise_custom_vocabs
(**`data_types`**)\n",
"\n",
@@ -2214,7 +2339,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.get_template_class_id
[source]OmekaAPIClient.get_template_class_id
[source]OmekaAPIClient.get_template_class_id
(**`template`**)\n",
"\n",
@@ -2263,7 +2388,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.get_template_property_id
[source]OmekaAPIClient.get_template_property_id
[source]OmekaAPIClient.get_template_property_id
(**`template`**, **`term`**)\n",
"\n",
@@ -2322,7 +2447,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.format_resource_id
[source]OmekaAPIClient.format_resource_id
[source]OmekaAPIClient.format_resource_id
(**`resource_id`**, **`resource_type`**)\n",
"\n",
@@ -2369,7 +2494,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.prepare_property_value
[source]OmekaAPIClient.prepare_property_value
[source]OmekaAPIClient.prepare_property_value
(**`value`**, **`property_id`**)\n",
"\n",
@@ -2440,7 +2565,7 @@
{
"data": {
"text/markdown": [
- "OmekaAPIClient.get_template_properties
[source]OmekaAPIClient.get_template_properties
[source]OmekaAPIClient.get_template_properties
(**`template_id`**)\n",
"\n",
@@ -2734,21 +2859,22 @@
"data": {
"text/plain": [
"{'@context': 'http://timsherratt.org/collections/api-context',\n",
- " '@id': 'http://timsherratt.org/collections/api/items/899',\n",
- " '@type': 'o:Item',\n",
- " 'o:id': 899,\n",
+ " '@id': 'http://timsherratt.org/collections/api/items/999',\n",
+ " '@type': ['o:Item', 'schema:Newspaper'],\n",
+ " 'o:id': 999,\n",
" 'o:is_public': True,\n",
" 'o:owner': {'@id': 'http://timsherratt.org/collections/api/users/1',\n",
" 'o:id': 1},\n",
- " 'o:resource_class': None,\n",
+ " 'o:resource_class': {'@id': 'http://timsherratt.org/collections/api/resource_classes/161',\n",
+ " 'o:id': 161},\n",
" 'o:resource_template': {'@id': 'http://timsherratt.org/collections/api/resource_templates/5',\n",
" 'o:id': 5},\n",
" 'o:thumbnail': None,\n",
" 'o:title': 'The Bendigo Independent (Vic. : 1891 - 1918)',\n",
" 'thumbnail_display_urls': {'large': None, 'medium': None, 'square': None},\n",
- " 'o:created': {'@value': '2022-02-14T10:39:41+00:00',\n",
+ " 'o:created': {'@value': '2022-04-03T06:44:57+00:00',\n",
" '@type': 'http://www.w3.org/2001/XMLSchema#dateTime'},\n",
- " 'o:modified': {'@value': '2022-02-14T10:39:41+00:00',\n",
+ " 'o:modified': {'@value': '2022-04-03T06:44:57+00:00',\n",
" '@type': 'http://www.w3.org/2001/XMLSchema#dateTime'},\n",
" 'o:media': [],\n",
" 'o:item_set': [],\n",
@@ -2959,8 +3085,8 @@
" '@value': \"MR WRAGGE'S PREDICTION. RENEWAL OF CYCLONE FORETOLD.\"}],\n",
" 'schema:isPartOf': [{'property_id': 736,\n",
" 'type': 'resource:item',\n",
- " '@id': 'http://timsherratt.org/collections/api/items/899',\n",
- " 'value_resource_id': 899,\n",
+ " '@id': 'http://timsherratt.org/collections/api/items/999',\n",
+ " 'value_resource_id': 999,\n",
" 'value_resource_name': 'items'}],\n",
" 'schema:datePublished': [{'property_id': 928,\n",
" 'type': 'numeric:timestamp',\n",
@@ -3016,26 +3142,27 @@
"data": {
"text/plain": [
"{'@context': 'http://timsherratt.org/collections/api-context',\n",
- " '@id': 'http://timsherratt.org/collections/api/items/900',\n",
- " '@type': 'o:Item',\n",
- " 'o:id': 900,\n",
+ " '@id': 'http://timsherratt.org/collections/api/items/1000',\n",
+ " '@type': ['o:Item', 'schema:NewsArticle'],\n",
+ " 'o:id': 1000,\n",
" 'o:is_public': True,\n",
" 'o:owner': {'@id': 'http://timsherratt.org/collections/api/users/1',\n",
" 'o:id': 1},\n",
- " 'o:resource_class': None,\n",
+ " 'o:resource_class': {'@id': 'http://timsherratt.org/collections/api/resource_classes/543',\n",
+ " 'o:id': 543},\n",
" 'o:resource_template': {'@id': 'http://timsherratt.org/collections/api/resource_templates/4',\n",
" 'o:id': 4},\n",
" 'o:thumbnail': None,\n",
" 'o:title': \"MR WRAGGE'S PREDICTION. RENEWAL OF CYCLONE FORETOLD.\",\n",
- " 'thumbnail_display_urls': {'large': 'http://timsherratt.org/collections/files/large/f5ed7414ea6f98988a59b8b0e97235e678181216.jpg',\n",
- " 'medium': 'http://timsherratt.org/collections/files/medium/f5ed7414ea6f98988a59b8b0e97235e678181216.jpg',\n",
- " 'square': 'http://timsherratt.org/collections/files/square/f5ed7414ea6f98988a59b8b0e97235e678181216.jpg'},\n",
- " 'o:created': {'@value': '2022-02-14T10:39:49+00:00',\n",
+ " 'thumbnail_display_urls': {'large': 'http://timsherratt.org/collections/files/large/4ad01b874e1d7f94c659638f681b93287b231263.jpg',\n",
+ " 'medium': 'http://timsherratt.org/collections/files/medium/4ad01b874e1d7f94c659638f681b93287b231263.jpg',\n",
+ " 'square': 'http://timsherratt.org/collections/files/square/4ad01b874e1d7f94c659638f681b93287b231263.jpg'},\n",
+ " 'o:created': {'@value': '2022-04-03T06:45:04+00:00',\n",
" '@type': 'http://www.w3.org/2001/XMLSchema#dateTime'},\n",
- " 'o:modified': {'@value': '2022-02-14T10:39:49+00:00',\n",
+ " 'o:modified': {'@value': '2022-04-03T06:45:04+00:00',\n",
" '@type': 'http://www.w3.org/2001/XMLSchema#dateTime'},\n",
- " 'o:media': [{'@id': 'http://timsherratt.org/collections/api/media/901',\n",
- " 'o:id': 901}],\n",
+ " 'o:media': [{'@id': 'http://timsherratt.org/collections/api/media/1001',\n",
+ " 'o:id': 1001}],\n",
" 'o:item_set': [],\n",
" 'o:site': [],\n",
" 'schema:name': [{'type': 'literal',\n",
@@ -3053,8 +3180,8 @@
" 'property_id': 736,\n",
" 'property_label': 'isPartOf',\n",
" 'is_public': True,\n",
- " '@id': 'http://timsherratt.org/collections/api/items/899',\n",
- " 'value_resource_id': 899,\n",
+ " '@id': 'http://timsherratt.org/collections/api/items/999',\n",
+ " 'value_resource_id': 999,\n",
" 'value_resource_name': 'items',\n",
" 'url': None,\n",
" 'display_title': 'The Bendigo Independent (Vic. : 1891 - 1918)'}],\n",
diff --git a/docs/api.html b/docs/api.html
index a27b870..0b5cefd 100644
--- a/docs/api.html
+++ b/docs/api.html
@@ -168,7 +168,7 @@ OmekaAPIClient.ge
OmekaA
-items = omeka.filter_items_by_property(filter_property='schema:name', filter_value='WRAGGE.')
+items = omeka.filter_items_by_property(filter_property='schema:name', filter_value='wragge', filter_type='in')
assert len(items['results']) > 0
-assert items['results'][0]['schema:name'][0]['@value'] == 'WRAGGE.'
+assert 'wragge' in items['results'][0]['schema:name'][0]['@value'].lower()
+
+ {% endraw %}
+
+ {% raw %}
+
+
+
+
+
+
+items['results'][0]['schema:name'][0]['@value']
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{% endraw %}
@@ -854,7 +887,7 @@ Prepare an item payload
-OmekaAPIClient.prepare_item_payload
[source]
OmekaAPIClient.prepare_item_payload
(terms
)
+OmekaAPIClient.prepare_item_payload
[source]
OmekaAPIClient.prepare_item_payload
(terms
)
Prepare an item payload, ready for upload.
Parameters:
@@ -981,7 +1014,7 @@ OmekaAPICl
@@ -692,16 +692,49 @@