cancel
Showing results for 
Search instead for 
Did you mean: 

Invoke CAP action as a webhook with mime type application/x-www-form-urlencoded

mariusobert
Developer Advocate
Developer Advocate

Hi team,

I was just trying to call an CAP action as a webhook that uses the mime type "application/x-www-form-urlencoded" and got the following error:

No payload deserializer available for resource kind 'ACTION_PARAMETERS' and mime type 'application/x-www-form-urlencoded'

It works with the exact same payload when I use application/json but I cannot really control how the webhook is triggered. The action is defined as follows:

 action restock( ![Body] : String, ![From] : String, .... );
  

And I'm using the following versions:

@sap/cds: 5.7.5
@sap/cds-compiler: 2.11.4
@sap/cds-dk: 4.7.3
@sap/cds-foss: 3.0.0
Node.js: v16.13.2
bookshop: 1.0.0

Can you confirm that this is intended?

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

iwona.hahn david.kunz2 Sorry to bother you, can you help me?

david_kunz2
Advisor
Advisor

Hi Marius,

We only support application/json to trigger actions.

But you can add a custom express middleware to handle the incoming request (though you'd loose all generic functionality we provide, e.g. authorization).

Is that an option for you?

Best regards,

Accepted Solutions (1)

Accepted Solutions (1)

mariusobert
Developer Advocate
Developer Advocate

Thanks David. I'll go ahead and move the logic to a custom middleware then 🙂

Answers (0)