Adam Harkus
Adam Harkus

Reputation: 2210

SAP Build apps action. Can't read JSON from API

When running a test on an action in SAP Build, I get the following error:

{
"code": 12000,
"message": "Execution of action failed",
"correlationId": "27932dd7-91bf-4fe8-4402-19710945fc43",
"details": [
{ "code": 12000,
"message": "Failed to create action output for action get and response code 200: Cannot convert undefined or null to object",
"severity": "ERROR"
}
]

[
  {
    "description": "xxxxx",
    "metadata": {
      " below_unit": " -",
      " global_trade_item_number": 186,
      " in_unit": " -",
      " lead_time": 15,
      " max_energy_consumption": " -",
      " max_flow": 0,
      " max_rec_head": 0,
      " name": " Condenser Cleaner 600ml Box Lbl",
      " remotely": " -",
      " site_id": " BR1000",
      " sound_db": 0,
      " suction_lift": 0,
      " system_type": " -",
      " trunking": " -",
      "product_id": "6755",
      "score": 0.8306616847524148
    },
    "similarity_score": 0.8306616847524148
  },
  {
    "description": "xxxxxx",
    "metadata": {
      " below_unit": " -",
      " global_trade_item_number": 185,
      " in_unit": " -",
      " lead_time": 15,
      " max_energy_consumption": " -",
      " max_flow": 0,
      " max_rec_head": 0,
      " name": " Condenser Cleaner 1L Box Lbl",
      " remotely": " -",
      " site_id": " BR1000",
      " sound_db": 0,
      " suction_lift": 0,
      " system_type": " -",
      " trunking": " -",
      "product_id": "6725",
      "score": 0.823491177142724
    },
    "similarity_score": 0.823491177142724
  },
  {
    "description": "xxxxx",
    "metadata": {
      " below_unit": " -",
      " global_trade_item_number": 184,
      " in_unit": " -",
      " lead_time": 15,
      " max_energy_consumption": " -",
      " max_flow": 0,
      " max_rec_head": 0,
      " name": " Condenser Cleaner Conc 1L Box Lbl",
      " remotely": " -",
      " site_id": " BR1000",
      " sound_db": 0,
      " suction_lift": 0,
      " system_type": " -",
      " trunking": " -",
      "product_id": "6695",
      "score": 0.8102495639772882
    },
    "similarity_score": 0.8102495639772882
  },
  {
    "description": "xxxxx",
    "metadata": {
      " below_unit": " -",
      " global_trade_item_number": 187,
      " in_unit": " -",
      " lead_time": 15,
      " max_energy_consumption": " -",
      " max_flow": 0,
      " max_rec_head": 0,
      " name": " Universal Coil Cleaner Conc 1L Box Lbl",
      " remotely": " -",
      " site_id": " BR1000",
      " sound_db": 0,
      " suction_lift": 0,
      " system_type": " -",
      " trunking": " -",
      "product_id": "6785",
      "score": 0.8033885945712105
    },
    "similarity_score": 0.8033885945712105
  },
  {
    "description": "xxxxxx",
    "metadata": {
      " below_unit": " -",
      " global_trade_item_number": 139,
      " in_unit": " -",
      " lead_time": 15,
      " max_energy_consumption": " -",
      " max_flow": 0,
      " max_rec_head": 0,
      " name": " Conden Clean & Degr 600ml Label ES REV2",
      " remotely": " -",
      " site_id": " BR1000",
      " sound_db": 0,
      " suction_lift": 0,
      " system_type": " -",
      " trunking": " -",
      "product_id": "7060",
      "score": 0.7943730599435553
    },
    "similarity_score": 0.7943730599435553
  }
]

The body of the response also converts the whole payload into a string.

The above works fine when creating a data integration in SAP Build apps.

Also, simpler JSON seems to work fine in an SAP Build Action.

[
    {
        "xxx",
        "product_id": null,
        "product_name": null,
        "similarity_score": 0.8306556940078735
    },
    {
        "xxx",
        "product_id": null,
        "product_name": null,
        "similarity_score": 0.823538373497823
    },
    {
        "xxxxx",
        "product_id": null,
        "product_name": null,
        "similarity_score": 0.8102967256130754
    },
    {
        "product_description": "xxxx",
        "product_id": null,
        "product_name": null,
        "similarity_score": 0.8034826272459229
    }
]

Please advise as our API needs to be called from an SAP Build Action (to be used in a process automation), an SAP Build app or anywhere else.

Upvotes: 0

Views: 81

Answers (0)

Related Questions