Expand my Community achievements bar.

SOLVED

Airtable<>AEM Programmatic calls through API

Avatar

Level 1

Hello,

 

I'm trying to call the AEM HTTP API from Airtable's scripting block through a simple Javascript runtime environment. All my calls work fine on Postman, but not from Airtable. The GET calls go through fine, but the POST get a 403.

 

Any help much appreciated 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@mmaattee below is the sample code to allow post calls in dispatcher filter

 

/0211 { /type "allow" /method "POST" /path "/content/<path>/*" }

 

View solution in original post

5 Replies

Avatar

Community Advisor

Hi @mmaattee ,

 

Are you trying to Create an asset in AEM or retrieve it..?

In HTTP API use these methods as per requirements.

  • GET - to retrieve a JSON representation of an asset or a folder
  • POST - to create new assets or folders
  • PUT - to update the properties of an asset or folder
  • DELETE - to delete an asset or folder

In Your case, If you want to retrieve assets use GET, for example: /api/assets/myFolder.json

if you want to Create an Asset then use POST, like

POST /api/assets/myFolder -H"Content-Type: application/json" -d '{"class":"assetFolder","properties":{"jcr:title":"My Folder"}}'
POST /api/assets/* -F"name=myfolder" -F"jcr:title=My Folder"

 

I give a link for API Documentation here for your reference https://experienceleague.adobe.com/docs/experience-manager-65/assets/extending/mac-api-assets.html?l...  

Thanks,

Aditya Chabuku

Avatar

Community Advisor

@mmaattee can you give the environment details, AEM onprem or AEMaaCS ?

 

is the post call allowed in dispatcher?

Avatar

Correct answer by
Community Advisor

@mmaattee below is the sample code to allow post calls in dispatcher filter

 

/0211 { /type "allow" /method "POST" /path "/content/<path>/*" }

 

Avatar

Community Advisor

seems like the POST calls are filtered, please update your dispatcher configurations to allow the request and for your local environment you can disable the filter.

Avatar

Community Advisor

Hi @mmaattee ,

 

I have few queries-

 

1. When you have mentioned it is working using postman, is it same AEM endpoint which is not working Airtable's scripting block?

2. Have you checked Adobe Granite CSRF Filter, for example the user agents?

3. Have you validated if the request is allowed from dispatcher?

4. Have you checked 'Apache Sling Referrer Filter', the Allow Hosts one?

 

https://www.youtube.com/watch?v=Yn7ybOwfIYY&t=535s 

 

Thanks,

Ritesh