AEMasCS REST API calls from POSTMAN or any external application

This post details the steps to invoke REST API hosted in AEM as a Cloud Service (AEMasCS) instance from POSTMAN or any external application. 


As we all know AEM is REST based Web application and contents of Repository can be accessed via GET call to respective path (Eg say,  ".json" extension or content path with ".html" extension) and updates to Repository is possible via respective HTTP method type + API endpoint as exposed (Eg. Assets HTTP API Create Folder POST request)provided we have Authentication and Authorization to the accessing endpoints. 
  • Authentication is achieved using the credentials that we use to access our instance.
    • Eg. In our local AEM author instance, we login using admin/admin or any username as created/available in the respective instance
  • Authorization refers to the permissions to the path we are accessing 
    • Eg: If we are to make GET request on /content/we-retail.html, we need to have read permission on this path.
Given this understanding, when we want to access an endpoint from our AEM instance using POSTMAN, we need to set the Authentication information via  tab -> "Authorization" with respective Type. (Which would help generate an Authorization Header for making an HTTP request)
  • For Classic AEM instance, we need to use "Basic" Type -> respective Username and Password input as we would give in our AEM instance.
  • For AEMasCS instance(the one as hosted in cloud and NOT Cloud Service SDK instance), we need to use Token Based Authentication -> "Bearer" Type -> Token value as input. 
AEM instance 6.5.0:

Screenshot below highlights use of Assets HTTP API "Create Folder" request hosted in local classic AEM instance 6.5.0


AEMasCS instance:

For AEMasCS instance, Token value is acquired from AEM Developer console. 
  • For Local Development, we can use Temporary Access Token. 
  • For actual integration in case of an external application say from frontend app like React, we need to make use of Service Credentials. 
  • Details for the same is explained here in Adobe Doc with Video Demo and sample Node JS application for both Local Development Access Token and for Service Credentials
  • In POSTMAN, we need to input the Token as acquired above(using Local Development Access Token) in below highlighted screenshot. 
Note :  
  • Token Based authentication is required only when we access AEMasCS instance as available in cloud from any external application. 
    • In this case, external application is POSTMAN. 
    • In the sample illustrated in above Adobe doc, external application refers to Node JS application.
  • Highlighted in red in below screenshot is the dummy AEMasCS URL. I don't have access to any AEMasCS instance, It is used in the screenshot to highlight the usage.


I had a chance to respond to a query (related to this subject) raised in our Experience League Community recently. 
Below is the respective thread for reference. (Has sample request details to be used in React Code)

Comments

  1. Agile software outsourcing by a top Artificial Intelligence Technologies companies can help minimize costs and improve time to market.

    ReplyDelete
  2. Coin Development Company Coin Development Company is a trusted partner in cryptocurrency development, offering expert team, tailored solutions, innovative technology, security, and comprehensive support. We specialize in coin creation, token development, smart contracts, and blockchain consulting. Our team focuses on staying ahead of the curve, ensuring your coin stands out in the market, and providing ongoing maintenance and updates to keep your coin running smoothly.

    ReplyDelete

Post a Comment

Popular posts from this blog

Embedding Third party dependency/OSGi bundle in AEM application hosted in AEMasCS

OSGI Factory Configuration implementation

Creation of Template Types for Editable templates