Legacy Dev Forum Posts

 View Only

Sign Up

How to set the Response template in action

  • 1.  How to set the Response template in action

    Posted 06-05-2025 19:22

    chengcheng | 2022-03-22 02:17:52 UTC | #1

    Hi, we have an authentication API which return 2 type of structure for one request. if authentication success (input correct account and correct password), it return like this :

    if authentication failed (input wrong account or wrong password), it return like this :

    I set contracts and configure in this way,

    ![Screen Shot 2022-03-22 at 11.00.25

    690x210](upload://zv5N7p7NrNH2qZ7FBh135X6ugpU.png)

    ![Screen Shot 2022-03-22 at 11.01.23

    690x414](upload://mbX0AHbmkdSZbPofjl0taqCHfqn.png)

    but in the case of authentication failed, the output was failed.

    I think there are some wrong in my contracts and configure, but I do not know how to fix it, I attached my Json file, API.json | attachment (2.5 KB) please help.


    Jerome.Saint-Marc | 2022-03-22 15:14:51 UTC | #2

    Hello,

    There is an error in your translationMapDefaults.

    When authentication fails, there is no "customAttributes" in your response. So the default value set in translationMapDefaults will be used.

    The error is in the default values for ContextAttributesName and ContextAttributesValue. You have declared your output parameters as array of string. So default value for ContextAttributesName and ContextAttributesValue should be "[]". i.e.

    "translationMapDefaults": { "AuthenticationStatus": "\"\"", "ContextAttributesName": "[]", "ContextAttributesValue": "[]" },

    Regards,


    chengcheng | 2022-03-23 00:12:53 UTC | #3

    Hi Jerome

    thank you so much for your reply. solved it by following your suggestion.

    Regards, Chengcheng


    system | 2022-04-23 00:13:44 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 13994