Your customer engagement transformation starts here Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Developing with the MediaBin APIs David Roy / September, 2014
Introduction & Agenda Introduction MediaBin API Overview API Organization Programming Considerations Demo / Example Questions 3
Session Goals 1. Provide an introduction to the MediaBin API 2. Share best practices when using MediaBin API 3. Demonstrate use of the API 4
MediaBin API Overview
When to use MediaBin APIs Automating complex processes Expiration Audits Asset Retention Bulk Operations Reporting Integrating DAM into business processes (3 rd party applications) Search Ingest/Retrieve/Move/Copy/Delete Read/write metadata HPPA Workflows 6
Two APIs COM ( ScriptModel ) API Nice choice for VB Scripting Microsoft centric 32 bit Client-side footprint WebService API Platform independent Language agnostic SOAP Standard HTTP/XML traffic Easy to load balance No client footprint Hosted under IIS Used in: MediaBin s HPPA Integration MediaBin Client 7
200+ WebService Methods Folders & Collections Assets & Metadata Searches Workflows Associations Actions Tasks & Jobs Endpoint is: http://<mbinserver>/mbws/mediabinwebservice/viragemediabinserver.asmx Usually http://<mbinserver>/mbws redirects to this Will display a banner page if everything is setup correctly 8
MediaBin API Organization
Main Tools MBObjects Folder, Collection, Asset, Metadata, Job, etc. GUIDs identify all MediaBin objects Requesting an object = knowing its GUID Ways to determine: Pagers GetByPath methods Use sparingly Pagers Pagers generate lists of MBObjects E.g. contents of a Folder, Collection, Search Result, Saved Search, etc 10
MediaBin Classes Asset Class Container Class Metadata Definition Class Metadata Value Class Other (Task, TaskRevision, Job, Collection, MetadataGroup, AssetRevison, Action) 11
Asset Class Abstraction of Asset Represents the asset in MediaBin Does not retrieve the asset 12 Use MBAsset_RetrieveFile, MBAsset_RetrieveFileEx Members include Description Name GUID MBProperties MBProperties Common and useful details about asset parent folder, asset type, revision number, original vs reference asset, deleted, updating, externally indexed, locked, lock owner, etc. Can include specific metadata SetDefaultMetadata
Container Class Abstraction of Folder (aka container) Represents MediaBin folder Members include Description Name GUID MBProperties MBProperties Common and useful details about folder Asset count, child folder count, parent folder, isdeleted, isroot, human-readable path, candelete, canrename, etc. Can include specific metadata SetDefaultMetadata 13
Metadata Definition Class Abstraction of Metadata definition All types, including multi-value metadata Members include Description Name GUID MBProperties MBProperties Common and useful details about metadata value Type, iscustom, permissions, visibility, etc. 14
Metadata Value Class Abstraction of Metadata value All types, including multi-value metadata Members include 15 Value or Values Name GUID Formatted value Actual data is in Value or Values Depending on type (multi-value vs. single value) Generic Object Dates Must determine type and cast XMLGregorianCalendar
Other MediaBin Classes Similar in style Task TaskRevision Job Collection MetadataGroup AssetRevision Action 16
MediaBin Methods Methods to perform actions on MB Objects Generic MBObject Methods Handles actions common to all types Move, delete, rename, set permissions, etc. E.g. mbobjectcopy, mbobjectdelete, mbobjectsetname, etc. Type-Specific Methods Manipulate a specific MBObject type Asset, Container, Collection, Metadata, etc. E.g. mbassetretrievefile, mbcontainerinsertfile, mbcollectionaddassets, etc. 17
Retrieving lists of MediaBin Objects Pagers Pagers let you walk thru the contents of a container, or collection, or tasks, or etc Way to enumerate objects in a potentially large set (eg. a folder with 100000 assets) PagerCache calls most common Pagers are released when session ends (i.e. logout) no delete call 18
Pager methods Method Category Used for MBPagerCache_CreateAssetPager, MBPagerCache_CreateCollectionPager, MBPagerCache_CreateMetadataDefinitionPager, MBPagerCache_CreateAssociationPager, MBPagerCache_CreateContainerPager Create a pager to enumerate a list of Assets, Containers, Collections, Associations, Tasks, Metadata Definitions, MBPagerCache_GetPage MBPagerCache_GetPageByIndex MBPagerCache_GetAllObjects MBPager_GetPage, MBPager_GetPageByIDList, MBPager_GetPageByRangeIdentifiers, MBPager_GetPageByIndex Call this with the pager id to get a single page of objects (25 at a time) Call this with the pager id to get a single page of objects (variable page size) Get all the objects from the pager at once. Use with extreme caution. Less commonly used; Useful for getting a small, finite set of objects all in one call (e.g. associations, an enumerated list of assets). Use with caution. 19-19 -
20 Picking the right tools if you want to then use because Insert an asset MBContainer_InsertFile, MBContainer_InsertFileEx, MBContainer_InsertFileExternal, MBContainer_InsertFileExternalIntoContainerPath, MBContainer_InsertFileIntoContainerPath - 20 - Assets live in containers Update container security MBObject_SetPermissions Containers, Tasks, Metadata all have security (note: Collections have different security so they have a different call List all assets in a collection Create a new Metadata definition MBPagerCache_CreateAssetPager and MBPagerCache_GetPage / MBPagerCache_GetPageByIndex MBMetadata_CreateDateArrayMetadataDefinition, MBMetadata_CreateDateMetadataDefinition, MBMetadata_CreateIntegerMetadataDefinition, MBMetadata_CreateStringMetadataDefinition, etc. You want a pager that enumerates Assets You re creating a new metadata field Revise (edit) metadata on an asset MBObject_ReviseMetadataValues You re changing a property of an asset Get that very first GUID MBSession_GetMBObjectByPath Most APIs consume GUIDs; you need a place to start. use sparingly Monitor a bunch of jobs MBJob_SetCurrentBatchID and MBJob_GetBatchStatistics Avoids having to query status of each job individually
Programming Considerations
Invoking Web Services The Web Service Definition Language (WSDL) Pass the WSDL query string to the WebService endpoint URL http://<mbinserver>/mbws/mediabinwebservice/viragemediabinserver.asmx?wsdl Interrogate it to: establish function signatures understand the arguments for the calls you need WSDL2JAVA, wsimport, or the equivalent in your language of choice (gsoap, SOAP-Lite/Soap- WSDL, SUDS/pySimpleSoap, etc ) will generate classes/methods MediaBin WebServices uses xsi type information Might need to tweak SOAP to include, adjust or otherwise fix xsi:type attributes (Python) 22
From Java Three common choices Apache AXIS 1.0 Older, deprecated Still in use (MediaBin 8 Client, APA Extensions) Apache AXIS 2.0 New API Faster Apache CXF Builds on AXIS 2.0 High Performance Configurability WSDL validation control Supports authentication (esp. Negotiate) 23-23 -
State MediaBin API is Stateful State is maintained on Server for each session Login API returns your session cookie Must pass this in HTTP header for each call Thumbnail streamer calls too Framework will manage this CXF/AXIS 2.0/AXIS 1.0: Set BindingProvider.SESSION_MAINTAIN_PROPERTY to true Only for calls made through the framework Must enable Sticky Sessions if load balancing 24
Authentication Your App to WebServices WebService API has it s own authentication Login api Logon(user, password) Returns session cookie So, typically MBWS site will use Anonymous HTTP Unless Kerberos Authentication/Delegation Use Apache CXF for WebService bindings Set CXF AuthorizationType to Negotiate in CXF.xml Use LogonCurrentUser MediaBin WebService call Negotiate HTTP for MBWS site 25 Disable anonymous authentication
Performance WebServices are verbose Request/reply in HTML/XML Each call is expensive Make fewer calls But get back more with each E.g. use default metadata Turn on compression Usually better performance Use Apache CXF Higher performance interface 26
Default Metadata Return specific metadata with asset Get metadata with the MBAsset object Call once after logging in: mbobjectsetdefaultmetadataids( MBObjectType.ASSET, defaultids) Any metadata on defaultids list will be returned with the MBAsset object Eliminates need to make roundtrip for metadata Get metadata by examining Asset object s MBProperties 27
Demos
Demos We learned How to generate Java classes from MediaBin s WSDL How to build a simple MediaBin project in Eclipse How to connect and log in to MediaBin How to list the contents of a MediaBin folder How to show the metadata of a MediaBin asset How to show the preview of a MediaBin asset How to log out of MediaBin 29
How to monitor the MediaBin Client Turn up logging level in WebServices: Edit VMB WebService s Web.Config file Modify RequestLogVerbosity --- set value = 2 Will cause all SOAP envelopes to be dumped to WebServices log Do your action(s) in the MediaBin Client Examine log to see what WebService calls were used e.g. ReviseMetadata: <?xml version="1.0"?> -<Request StatusMsg="" StatusCode="0" Resource="http://www.viragemediabin.com/MBObject_ReviseMetadataValues" User="" ClientIP="127.0.0.1" End="10:16:20.791" Start="10:16:18.69"> <RequestBody><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"><soapenv:body><mbobject_revisemetadatavalues xmlns="http://www.viragemediabin.com"><objecttype>asset</objecttype><objectid>{b7a10158-87eb-46da-8a6d- 01F2FA532888}</objectID><metadataParams><MBMetadataParameter><Identifier>{E94A2180-582A-11D4-8104- 0050DA27F4FC}</Identifier><Value xsi:type="xsd:string">foobar</value></mbmetadataparameter></metadataparams><metadataids /></MBObject_ReviseMetadataValues></soapenv:Body></soapenv:Envelope></RequestBody> </Request> 30-30 -
Wrap Up
Why Professional Services? Your go-to Experts for HP MediaBin Services Faster time to value Reduced risk Direct access to support & roadmaps Reduced support calls Maximize 32 the value of your investment
Tools and Resources Available Resources: MediaBin 8.x Programming Reference Guide, Product Documentation, Release Notes, FAQ s - https://customers.autonomy.com/support/login.jsf MediaBin Technical Blog, follow David Roy - http://h30499.www3.hp.com/t5/hp-autonomy-blog/bg-p/hpautonomy-blog HP MediaBin related Webinars http://www.autonomy.com/work/events/webinars/ HP Autonomy elearning Modules - https://registration.autonomy.com/elearning/courses.php White Papers and Solution Briefs - http://www.autonomy.com/offerings/marketing-optimization/richmedia-management DevNet - https://community.dev.hp.com/t5/mediabin/bd-p/mediabin 33
Questions????? 34
Contact Reach out to your Professional Services Experts with any questions: David Roy david.roy@hp.com Raj Patel rpatel3@hp.com 35
THANK YOU Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.