This discussion is archived
5 Replies Latest reply: Mar 22, 2013 11:14 AM by José Márcio Teixeira Júnior RSS

How to use ADD_RELATED_CONTENT and GET_RELATED_CONTENT

José Márcio Teixeira Júnior Newbie
Currently Being Moderated
Hello guys,

I need to relate one content to another content, so I enabled RelatedContent component in my webCenter instance.

Now, I'd like to know the required and optional parameters for ADD_RELATED_CONTENT and GET_RELATED_CONTENT service, If someone post a simple example about how to use this service would be enough for me.

Thanks in advance.

José.

Edited by: José Márcio Teixeira Júnior on 21/03/2013 17:26
  • 1. Re: How to use ADD_RELATED_CONTENT and GET_RELATED_CONTENT
    jiri.machotka Guru
    Currently Being Moderated
    Unfortunately, these services are not documented.

    You can, however, find out yourself - see Re: unable to create related link because of error

    Also this post error when i call ADD_RELATED_CONTENT in production enviroment might be helpful.
  • 2. Re: How to use ADD_RELATED_CONTENT and GET_RELATED_CONTENT
    Srinath Menon Guru
    Currently Being Moderated
    Hi ,

    Sample code snippet for GET_RELATED_CONTENT using RIDC :

    dataBinder.putLocal("IdcService", "GET_RELATED_CONTENT");
    dataBinder.putLocal("dSource","CS");
    dataBinder.putLocal("dID","3202");
    dataBinder.putLocal("dLinkTypeID","1");

    serializer.serializeBinder (System.out, dataBinder);
    // Send the request to Content Server
    ServiceResponse response = idcClient.sendRequest(userContext,dataBinder);
    // Get the data binder for the response from Content Server
    DataBinder responseData = response.getResponseAsBinder();
    // Write the response data binder to stdout
    serializer.serializeBinder (System.out, responseData);
    // Retrieve the SearchResults ResultSet from the response
    DataResultSet resultSet = responseData.getResultSet("RelatedContent");

    // Iterate over the ResultSet, retrieve properties from the content items
    for (DataObject dataObject : resultSet.getRows ()) {

    System.out.println ("Related ContentID is : " + dataObject.get ("dDocName") );
    }

    Point to note :

    dLinkTypeID is set to 1 since in the example the content has only Renditions created .

    If it has superseded content then it would be 2

    Has Supporting Content - 3

    For supports the parameters to be used are : dLinkTypeID=3
    isGetParents=1

    Cross reference - 4

    For Cross Referenced By parameters to be used are : dLinkTypeID=4
    isGetParents=1


    Hope this helps.

    Thanks,
    Srinath

    Edited by: Srinath Menon on Mar 22, 2013 9:48 AM
  • 3. Re: How to use ADD_RELATED_CONTENT and GET_RELATED_CONTENT
    Srinath Menon Guru
    Currently Being Moderated
    Hi ,

    Sample code snippet for GET_RELATED_CONTENT is as follows :

    dataBinder.putLocal("IdcService", "GET_RELATED_CONTENT");
    dataBinder.putLocal("dSource","CS");
    dataBinder.putLocal("dID","3202");
    dataBinder.putLocal("dLinkTypeID","1");

    serializer.serializeBinder (System.out, dataBinder);
    // Send the request to Content Server
    ServiceResponse response = idcClient.sendRequest(userContext,dataBinder);
    // Get the data binder for the response from Content Server
    DataBinder responseData = response.getResponseAsBinder();
    // Write the response data binder to stdout
    serializer.serializeBinder (System.out, responseData);
    // Retrieve the SearchResults ResultSet from the response


    DataResultSet resultSet = responseData.getResultSet("RelatedContent");

    // Iterate over the ResultSet, retrieve properties from the content items
    for (DataObject dataObject : resultSet.getRows ()) {

    System.out.println ("Related ContentID is : " + dataObject.get ("dDocName") );
    }



    Point to note is :

    dLinkTypeID is set to 1 . Reason being that the rendition related content is used to link items . So looking for those related items which are as Renditions .

    This value would be as follows :


    dLinkTypeID Related content type
    1 Rendition
    2 Supersedes
    3 Has Supporting content
    4 Cross References

    2 more sub types are :

    Supports - dLinkTypeID=3 and extraparameter is isGetParents=1
    Cross Referenced By - dLinkTypeID=4 and extraparameter is isGetParents=1


    Hope this helps .

    Thanks,
    Srinath
  • 4. Re: How to use ADD_RELATED_CONTENT and GET_RELATED_CONTENT
    José Márcio Teixeira Júnior Newbie
    Currently Being Moderated
    Thank you Srinath. Now, it works perfectly!
  • 5. Re: How to use ADD_RELATED_CONTENT and GET_RELATED_CONTENT
    José Márcio Teixeira Júnior Newbie
    Currently Being Moderated
    Thank you Srinath. Now, it works perfectly!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points