Ingest_url for REST API

Hi, I’m trying to figure out how to give Omeka S’ REST API the url of a media file (a vtt-formatted transcript) for it to import. I’m able to add an item via the REST API (I use httpie rather than curl), however I’m having a lot of trouble getting it to upload a media file and thought uploading the file via URL might be easier. When I do this, however, I get the error “No ingest URL specified”. Should I be using the ingest_url key, and should I put it under data as in the example below, or somewhere else? thanks!

{
  "o:ingester": "upload",
  "@type": "o:Media",
  "o:lang": "en",
  "o:source": "/home/joeeasterly/test_transcript.en.vtt",
  "@context": "https://example.org/api-context",
  "o:resource_class": null,
  "o:thumbnail_urls": [],
  "o:renderer": "file",
  "o:title": "My Test Transcript",
  "o:owner": {
    "@id": "https://example.org/api/users/1",
    "o:id": 1 },
  "o:media_type": "text/vtt",
  "o:is_public": true,
  "data": [ { "ingest_url": "https://example.org/drop/test.en.vtt" } ],
  "o:item": {
    "@id": "https://example.org/api/items/25417",
    "o:id": "25417" }
  }

I see two immediate issues here:

  1. You’re specifying the upload ingester and not the url ingester. (I’m assuming this is more an artifact of what you posted here, since your reported error is one from the url ingester)
  2. Your data key is an array containing an object, when it should just be an object.

You’re also specifying a lot of data that won’t be respected on a create or is likely unnecessary (the owner will be set to the user that owns the key you’re using automatically, the media type and renderer and thumbnail urls and all that are just not looked at all in this context, etc.), but that’s not really related to your problem per se.

Thanks John! So is this how I should provide the URL for the VTT file to be uploaded— by adding ingest_url to data?

{
  "o:ingester": "upload",
  "@type": "o:Media",
   "@context": "https://example.org/api-context",
  "o:title": "My Test Transcript",
  "o:is_public": true,
  "data": { "ingest_url": "https://example.org/drop/test.en.vtt" },
  "o:item": {
    "@id": "https://example.org/api/items/25417",
    "o:id": "25417" }
  }

Yes, that looks right as far as the ingest_url.

Have you tried it? I notice the ingester is still set to upload.

The most basic structure for adding media via a URL is this:

{
    "o:item": {"o:id": <id>},
    "ingest_url":"<url>",
    "o:ingester":"url"
}

Replace <id> with the item ID and <url> with the image URL.

Yes sorry, we have a couple things called “data” in this space.

Jim’s correct that ingest_url just goes in the top level of the JSON payload directly, not within the data key at all.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.