Data Action-Translation Maps

Hello,
I am working on my integration action information. I am trying to create a custom action by taking id as input and from that I am going to get user info such as avatar and first/last name of the user.
INPUT CONTRACT
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "User Info Request",
"description": "Fields needed in the body of the POST to create a calendar reminder.",
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "number"
}
},
"additionalProperties": true
}

OUTPUT CONTRACT
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "data",
"description": "",
"type": "object",
"properties": {
"avatar": {
"type": "string"
},
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
}
},
"additionalProperties": true
}

RESPONSE
{
"translationMap": {
"first_name": "$first_name",
"last_name": "$last_name",
"avatar": "$avatar"
},
"translationMapDefaults": {},
"successTemplate": "${rawResult}"
}

When I try to test I got an error which is :

Resolve translation map: Failed while processing the translation map. Could not resolve value for the key: 'first_name' and no default value was configured. Additional details: Illegal character at position 1 expected '.' or '['

What I do wrong? I am new at coding. Any help would be appreciated.
Sincerely,

Actually in the beginning my request URL was wrong. I changed my request url to this --> [https://reqres.in/api/users/${input.id}]
Right now While response like below
{
"translationMap": {},
"translationMapDefaults": {},
"successTemplate": "${rawResult}"
}
It receives the correct information about the input id I give, without output contracts.
The problem is now when I arranged output contracts like this;
{
"title": "data",
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
}
},
"additionalProperties": true
}


It receives correct json but doesn't fill the output template. I tried to add arrays and first_name : $.first_name kind of solutions however it respond an error or remained the same. Do u have any suggestions?
Thank you in advance.

Hello,

Your Output Contract should be set like this:

{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "first_name": {
          "type": "string"
        },
        "last_name": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}

Regards,

Thank you Jerome. It solved my problem.

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