HPRM Service API - How to create new record and assign person to ACLs

Hi all,


I am new to HPRM integration, Jsut want to ask is there any way to create a new record as well as assigning some person to the ACL using HPRM Service API ? I the following code and json data however, it only create the new record but did not assign person to the access control list.



json data



 "RecordRecordType":"Job Container",
 "AccessControlList" :  {
     "FunctionEnum" : "RecordAccess",
     "FunctionProfiles" : {
         "ViewDocument" : {
               "AsString" : "Tester",
               "Caption" : "View Document",
               "ReferenceStyle" : "NoRefNoCopy",
               "Setting" : "Private"


c# code.


string response = client.UploadString("">localhost:53726/.../Record", jsonData);




Any help will be appreciated



  • Hi,


    I am currently using HPRM and may be future version like 8.1.1.xxxx.







  • Hi,


    thanks. It works!!


    Just an additonal question would like to ask, can this operation being done using Using the .Net Client Libraries which mentioned in HPRMServiceAPI/help/dotnetclient? I try creating the same record using the same informaiton, but doesn't work. It keeps throw exception with RecordType, I guess that I cannot work out how to define the recordType using dotnetclient. This is why I move to create my json data without using the HP.HPTRIM.Service.Client.TrimClient.






  • I just updated the blog post to create create the record and set the ACL from the client libraries.

  • Hi,


    Thanks for the example, but how to create a recrod that the is a custom record type? You previously showed me to use RecordRecordType in Json appoach, in .NET client library, I tried

    RecordType = new RecordTypeRef() { Name = "Job Container" }; 

    instead of


    RecordType = new RecordTypeRef() {Uri = 2 }; 


    and ServiceAPI  throw exception with message missing Record Type.










  • I am not sure what you mean by custom record type, all record types are custom and they all have a URI.  If you want to specify your record type you can use its URI in the Uri property.



    However, if you prefer to use the record type name there is a way.  The FindBy property takes a search string which must return only one record type.  So you can pass the name there or any other search string that will return one record type.


    Record request = new Record()
        Title = "test with ACL",
        RecordType = new RecordTypeRef() { FindBy = "Infringement" },
        AccessControlList = acl
  • hi,


    Thanks for the example. I think this is what I want. I have tried the example you post for the .NET Client library, just want to know what namespace the

    acl.FunctionProfiles = new FunctionProfilesDictionary();

    "Bold" constructor under?


    I have tried the following declaration but doesn't seem to find it.


    using HP.HPTRIM;
    using HP.HPTRIM.ServiceModel;
    using HP.HPTRIM.Service;
    using HP.HPTRIM.Service.Client;
    using ServiceStack.Common;
    using ServiceStack.ServiceInterface;
    using ServiceStack.Text;
    using ServiceStack;

  • Sorry, that is in a later version of the client code that I was using.  You can do the following, it producses exactly the same output and will continue to work with later versions of the ServiceAPI.


    acl.FunctionProfiles = new Dictionary<string, TrimAccessControlFunction>();
  • Hi,


    Thanks so much. I have made the example work on my machine. Now I understand that I can either call serviceAPI using json data or through ServiceAPI .NET client library. Now I need to decide which way I go.


    I need to interact with HPRM using serviceAPI from a MVC web project (C#), I am thinking to use ServiceAPI .NET client library, but I am bit concerning on maintenance part. With using ServiceAPI .NET client library, I need to reference to HPRM .NET client library, there is a chance that the library will be updated and I need to recompiled my project, am  I correct?


    If I use ServiceAPI with json, it seems that I don't need to concern with referencing problem.  You are a great integrator with HPRM, do you have any opinions about using both appoaches (ServiceAPI with Json and ServiceAPI with .NET client library) in the server side integration?





  • First question, if this is a server side application is there a reason you are using the ServiceAPI at all?  If it is possible to install the HP RM client on the server machine then you should consider using the .Net SDK.


    Our goal with the client library is that it should be forward compatible, so we do not change the existing service interface in such a way as to break existing applications.  If we do make such a change there is always the chance that your integration will break even if you are using raw JSON.


    JSON versus client library is really a choice only you can make.  If you interact with HP RM a lot you might end up writing your own equivelant of our client library so migt as well use ours, if you only send one or two requests to the ServiceAPI you might prefer to roll the JSON yourself and post it using the C# WebClient classes.  Some of our own integrations do this so as to avoid shipping the DLLs required to support the ServiceAPI client.

  • Hi,


    Thanks for your information. At the moment, we did not propose to install HPRM client to the MVC project server, HPRM is located another server with ServiceAPI installed and we are thinking to use serivceAPI to communicate with HPRM. I guess the bottom is rather there is anything serviceAPI can not do compare with .NET SDK?


    In general, we are only using ServiceAPIs to perform the following tasks


    1) Create/Edit/Delete Record

    2) Set ACL on records

    3) Check in/check out document








  • The ServiceAPI can do all that.  You would probably expect better performance via the .Net SDK though.

Reply Children