How to use CMServiceAPI to connect and save the document to CM23

Is there anyone to provide the User Guide how to use CMServiceAPI ? Thank

  • 0

    Hi There, 

    Depending on how the ServiceAPI was configured during installation, it comes with with a Help Index and a Swagger interface. 

    http://<ServerName>/CMServiceAPI/help/index

    http://<ServerName>/CMServiceAPI/swagger-ui/

    Some knowledge of your Content Manager instance will be required to assist with structuring of the payload to meet any CM requirements for capturing documents into the system. 

  • 0   in reply to 

    In the built in self-hosted documentation under 'Samples' (a bit down on the landing page) there should be one for 'Create a Record from a document'

    To see the payload you should be able to open up the network monitor using your web browsers dev tools to look how the payload was crafted to suit your particular dataset.

    -Scotty

  • 0 in reply to   

    Thank Scotty. Through http://<ServerName>/CMServiceAPI/swagger-ui/  I got the following much information. Where can I get the User Guide how to use each URLS (Post, GET, PUT, PATCH and Delete) For example, how to get the record type, unique identifier, container, classification and so on and how to inject the document into CM23

  • Verified Answer

    +1   in reply to 

    Each object type has its own endpoint

    So there is a:

    CMServiceAPI/Record/

    CMServiceAPI/RecordType/

    CMServiceAPI/Classification/

    If you expand out any of the endpoints listed in /swagger-ui/ it will then list out what a GET and a POST is typically used for, along with parameters that you can pass in for each. 

    This is where knowledge of your own dataset will come in, as the URI's sent as part of a payload will need to match your own record types.

    Typically the GET endpoints are used for retrievals 'Searches' and the POST endpoints are used for creation and updating. There isn't a PUT / PATCH / DELETE.

    As the swagger documentation is extremely verbose, I recommend browsing through the samples on the landing page as there are 60 pre-built samples that use JS to pull data from your dataset to show how GET or POST payloads should appear.

    localhost/.../index

    -Scotty

  • 0 in reply to   

    Hi Scotty,

    I tried to use https:/domanname/CMServiceAPI/Record/ through postman. It requested me to sign in. Do you know which url is for authentication?

  • 0   in reply to 

    Hmm looks like your auth is being handled by a third party (aadcdn.msftauth.net) and is separate from normally allowing IIS to handle the authentication (Basic vs NTLM in the header).

    Tricky to say as it would depend on the authentication provider itself how you would first need to retrieve a bearer-token or similar which would normally then need to be added as part of your request authentication headers in subsequent calls.

    I recommend having a chat with the team that handled your implementation to get guidance on the authentication provider used, from there, follow the authentication providers guide on how your application should then authenticate.

    -Scotty

  • 0 in reply to   

    Noted with thank, Scotty

  • 0 in reply to 

    Hi Scotty,

    I fixed the previous problem using postman. I have tried to use the sample code from https://github.com/content-manager-sdk/Community/tree/master/Samples/ServiceAPI/CSharp/ConsoleServiceAPIClient. I have a question where I can get scopeClientId. I have clientID, tenantId, clientSecret, Username, password and Uri except for scopeClientId. I got the following error - scope is not valid.  We have used domain/CMServiceAPI. 

  • 0 in reply to 

    The Scope is for OpenID authentication only and is specific to your OpenID issuer.  If you are using MS Azure, this will need to be the Application ID URI obtained from the Overview page of the 'App Registration' for the TRIM Service API with '/.default' appended to it.

    For example, if the Application ID URI of the Service API registration is 'api://0723a671-5527-44b7-8f7e-c45688843a74', then this scope setting must be 'api://0723a671-5527-44b7-8f7e-c45688843a74/.default'.

    Also, you're going to have to make sure your Service API instance is configured correctly to use OpenID with correct client ID, secret etc.  The instructions are in the documentation for the web client and not in the service API documentation where you might expect to find them.

  • 0 in reply to 

    Thank Jamie. I got CM23.4_WebClient.pdf. Is that what you mentioned the documentation for the web client?