External API - PUT /{eventId}/metadata

190 views
Skip to first unread message

Fa Ko

unread,
Mar 13, 2017, 10:58:50 AM3/13/17
to Opencast Users
Hi everybobdy :-)

i am trying to use the external API to update metadata from specific videos.

https://opencast-server.de/docs.html?path=/api/events
Form action: /api/events/{eventId}/metadata

Required fields:
eventID :
type    :
metadata:

Example scenario: i want to change the series or title through the external api out of our LMS.
Now i want to use the external API to update the metadata to the given eventID, but dont know
how to fill the "type" and "metadata" fields correctly even what is expected.

For type, i tried "events" , "dublincore/episodes" or "EVENTS.EVENTS.DETAILS.METADATA.TITLE"
For metadata the full catalog or the specific field of the metadata catalog.
In most cases the API responses with a Status 200 OK

But in the opencast logs the same ERROR occurs every time:
2017-03-13 15:10:40,912 | ERROR | (AbstractFaultChainInitiatorObserver:101) - Error occurred during error handling, give up!
org.apache.cxf.interceptor.Fault: org.json.simple.JSONObject cannot be cast to org.json.simple.JSONArray


Can anybody provide a working example or tell me what the API is expecting?

Regards

Sven Stauber

unread,
Mar 13, 2017, 12:43:40 PM3/13/17
to Opencast Users
Hi Fabian,

With curl, this looks like: 

curl -u <api_user>:<api_password> -X PUT -d 'metadata=[{"id":"title","value":"Test Change Title"}]' '<admin-node>/api/events/<event-id>/metadata?type=dublincore/episode'

So very much what the documentation says: The type is a query parameter that must be set to the flavors of the metadata catalog you want to change which is dublincore/episode for events and dublincore/series for series (and whatever else you have configured in case you use extended metadata).

Note that...
- The API user must have access to the respective event
- Metadata fields that are not set here will just keep the value they have -> To change the title only, you only need to set the title

I've tested the curl command above - it does work.

Best,
Sven

Stephen Marquard

unread,
Mar 13, 2017, 12:54:22 PM3/13/17
to Opencast Users

It's worth noting that the External API documentation is at:


https://docs.opencast.org/develop/developer/api/


although that's not completely obvious because these docs are not linked from the less-detailed REST docs at /docs.html?path=/api, nor are they linked from the development docs home page at https://docs.opencast.org/develop/developer/ - you have to scroll down the navigation menu on the left to find them.


Cheers

Stephen

Next . Built with MkDocs using a theme provided by Read the Docs.. BitBucket Next »


From: Sven Stauber <sven.s...@switch.ch>
Sent: 13 March 2017 06:43:40 PM
To: Opencast Users
Subject: [OC Users] Re: External API - PUT /{eventId}/metadata
 
--
You received this message because you are subscribed to the Google Groups "Opencast Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to users+un...@opencast.org.
Disclaimer - University of Cape Town This e-mail is subject to UCT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. If this e-mail is not related to the business of UCT, it is sent by the sender in an individual capacity. Please report security incidents or abuse via cs...@uct.ac.za

Fa Ko

unread,
Mar 14, 2017, 6:39:41 AM3/14/17
to Opencast Users
Hi everyone,

you are right, via curl out of a linux bash it is working fine, thanks for that.

For first tests an initial sights into the topic i use the GUI with its corresponding REST-APIs (Test foms).
And exact that API, which i posted above, is not reacting like i thought. The API i also not reacting correct with same data of your curl command just pasted into the fields.

Maybe i am cofused but maybe a bug is hiding behind this one.

Regards and also thanks to Stephen for the very helpful Link!
Reply all
Reply to author
Forward
0 new messages