Expand my Community achievements bar.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!
SOLVED

Custom API call POST request

Avatar

Level 2

Hi, I'm making a post request using 'Make a custom API call' module from workfront fusion scenario and getting 500 Error. Could anyone suggest what changes are needed in below configuration? Thanks in advance!

Screenshot 2024-10-22 at 10.00.15 AM.png

1 Accepted Solution

Avatar

Correct answer by
Level 2

This was resolved by setting the content into Request body instead of query string parameter

View solution in original post

7 Replies

Avatar

Level 6

That's a very large string for content.  Typically, you'd set Content-Type to application/json and POST the body as the JSON itself.  What API are you trying to hit?

Avatar

Level 2

Hi @cverges-medallia I'm creating new nodes in AEM dam and need to make a POST call with content type application/x-www-form-urlencoded

Avatar

Level 6

I don't have an AEM Assets connection, so I can't screenshot anything.  However, typically in the Custom API modules, there's a URL entry that points to a specific API endpoint (defined via mechanisms such as https://developer.adobe.com/experience-cloud/experience-manager-apis/api/stable/sites/).  To really understand what API you're trying to use and why it may be erring, what's the URL that's in your module?

Avatar

Level 2

This is how I have set my URL: 

decodeURL("content/dam/<asset folder name>/Myasset.jpeg")

Avatar

Level 6

This is likely your main issue.  Would focus on setting a proper URL as per their API spec.

Avatar

Level 5

Hi @aembee 

 

I'm not worried about the content size, I've done larger but: 

  • use SetVariable module(s) prior to your AEM module and then use those variable in the AEM module. 
    I find it easier to troubleshoot that. 
  • validate the JSON to ensure there's no illegal char

I don't know what URL you're hitting here, but 500 means AEM didn't like what you sent. Could be content type; names of parameters etc. 

Do click the toolkit icon in Fusion to see the actual call made. And check that it 100% matches what the Assets API spec expects. 

Avatar

Correct answer by
Level 2

This was resolved by setting the content into Request body instead of query string parameter