9.2.1 Rest API Change a batch of single entities not working as expected

I am trying to Change a batch of single entities. This is not updating existing entities as expected, instead, it is creating new records into the ACCProduct table. These UIDs correspond to existing ACCProduct entries. Am I doing something wrong?

version: 9.2.1

req URI:

https://<Hostname>/AppServer/api/entities

JSON:

{
"entities": [
{
"table": "ACCProduct",
"uid": "982f3ec0-0b36-42c4-9d3c-fdea773b5edd",
"values": {
"description": "Test description 1",
"Ident_ACCProduct": "example name 1"
}
},
{
"table": "ACCProduct",
"uid": "ddbccd16-46b6-4cd2-89c0-f6042e8f788a",
"values": {
"description": "Test description 2",
"Ident_ACCProduct": "example name 2"
}
},
{
"table": "ACCProduct",
"uid": "60a67a5f-12ad-4632-ae14-da69236c0020",
"values": {
"description": "Test description 3",
"Ident_ACCProduct": "example name 3"
}
}
]
}

Parents
  • Thanks for the reply, Markus. I should have specified. I am doing a post request.

    Invoke-RestMethod -Uri $reqUri -Body $jsonOutput -WebSession $wsession -Method POST -ContentType application/json -Headers @{Accept="application/json"}

  • Good catch. I think the documentation is wrong, and you need to use a PUT instead of POST at least according to the API documentation page in the Application Server itself?

    Can you test if using a PUT solves your issue? I will contact the documentation team then. 

  • Using the same JSON, and this:
    Invoke-RestMethod -Uri $reqUri -Body $jsonOutput -WebSession $wsession -Method PUT -ContentType application/json -Headers @{Accept="application/json"}

    Returns this oddly formatted message:
    "errorCode":"NotFound","message":"Entity with key ACCProduct982f3ec0-0b36-42c4-9d3c-fdea773b5edd was not found."

    I just rechecked to confirm that that UID corresponds to a valid ACCProduct entry. I am not sure why it is combining the UID and the table name in the message.

Reply
  • Using the same JSON, and this:
    Invoke-RestMethod -Uri $reqUri -Body $jsonOutput -WebSession $wsession -Method PUT -ContentType application/json -Headers @{Accept="application/json"}

    Returns this oddly formatted message:
    "errorCode":"NotFound","message":"Entity with key ACCProduct982f3ec0-0b36-42c4-9d3c-fdea773b5edd was not found."

    I just rechecked to confirm that that UID corresponds to a valid ACCProduct entry. I am not sure why it is combining the UID and the table name in the message.

Children
  • I tried to reproduce this with a 9.2.1 build. I can confirm that you must use the PUT method. But my error message looks like this (pure JSON return value)

    {
      "responseStatus": {
        "errorCode": "NotFound",
        "message": "Entity with key <Key><T>ACCProduct</T><P>982f3ec0-0b36-42c4-9d3c-fdea773b5edd</P></Key> was not found.",
        "errors": []
      }
    }