How to update an entity via API?

Sorry for the beginner’s nature of this question, I have managed to create an entity via API in the sandbox environment, I have given the entity id 177 in the ‘meta’ section.
https://api-sandbox.yext.com/v2/accounts/me/entities?api_key=079afb52dbfe768e7ea6482d1cd149d4&v=20231213&entityType=healthcareFacility
with body:

{
    "meta": {
        "id": "177"
    },
  "name": "Bozeman MT-Main St-BIO",
  "address": {
    "city": "Madison",
    "region": "CA",
    "postalCode": "08530",
    "countryCode": "US",
    "line1": "Adress line2"
  },
  "hours": {
    "friday": {
      "isClosed": false,
      "openIntervals": [
        {
          "end": "18:00",
          "start": "08:00"
        }
      ]
    },
    "monday": {
      "isClosed": false,
      "openIntervals": [
        {
          "end": "18:00",
          "start": "08:00"
        }
      ]
    },
    "saturday": {
      "isClosed": false,
      "openIntervals": [
        {
          "end": "18:00",
          "start": "08:00"
        }
      ]
    },
    "sunday": {
      "isClosed": false,
      "openIntervals": [
        {
          "end": "18:00",
          "start": "08:00"
        }
      ]
    },
    "thursday": {
      "isClosed": false,
      "openIntervals": [
        {
          "end": "18:00",
          "start": "08:00"
        }
      ]
    },
    "tuesday": {
      "isClosed": false,
      "openIntervals": [
        {
          "end": "18:00",
          "start": "08:00"
        }
      ]
    },
    "wednesday": {
      "isClosed": false,
      "openIntervals": [
        {
          "end": "18:00",
          "start": "08:00"
        }
      ]
    }
  }
}

Now I want to update this entity, but when I execute the following call:
https://api-sandbox.yext.com/v2/accounts/me/entities/177?api_key=079afb52dbfe768e7ea6482d1cd149d4&v=20231213
with this body:

{
  "name": "Bozeman MT-Main St-UPDATED"
}

I always get the following error:
“code”: 46,
“type”: “FATAL_ERROR”,
“message”: “HTTP method not allowed for this resource.”,
“name”: “method_not_allowed”

Somebody could help me please?

Hello @Alex_Palop

Please use below mentioned request URL with Put method with same body. it must work as it is working my end.

https://sbx-api.yextapis.com/v2/accounts/me/entities/177?api_key=079afb52dbfe768e7ea6482d1cd149d4&v=20181129

Domains: Since the domains has been updated recently, i have used the appropriate one. the details is accessible via

For sharing it with you, The Result i got:

{
    "meta": {
        "uuid": "018cd985-5d3b-ac75-9c92-cfdd2497079d",
        "errors": []
    },
    "response": {
        "address": {
            "line1": "Adress line2",
            "city": "Madison",
            "region": "CA",
            "postalCode": "08530",
            "countryCode": "US"
        },
        "hours": {
            "monday": {
                "openIntervals": [
                    {
                        "start": "08:00",
                        "end": "18:00"
                    }
                ]
            },
            "tuesday": {
                "openIntervals": [
                    {
                        "start": "08:00",
                        "end": "18:00"
                    }
                ]
            },
            "wednesday": {
                "openIntervals": [
                    {
                        "start": "08:00",
                        "end": "18:00"
                    }
                ]
            },
            "thursday": {
                "openIntervals": [
                    {
                        "start": "08:00",
                        "end": "18:00"
                    }
                ]
            },
            "friday": {
                "openIntervals": [
                    {
                        "start": "08:00",
                        "end": "18:00"
                    }
                ]
            },
            "saturday": {
                "openIntervals": [
                    {
                        "start": "08:00",
                        "end": "18:00"
                    }
                ]
            },
            "sunday": {
                "openIntervals": [
                    {
                        "start": "08:00",
                        "end": "18:00"
                    }
                ]
            }
        },
        "name": "Bozeman MT-Main St-UPDATED",
        "timezone": "America/New_York",
        "yextDisplayCoordinate": {
            "latitude": 40.3656044,
            "longitude": -74.9061203
        },
        "meta": {
            "accountId": "3258860",
            "uid": "dR5Vlw",
            "id": "177",
            "timestamp": "2024-01-05T12:07:25",
            "folderId": "0",
            "language": "en",
            "countryCode": "US",
            "entityType": "healthcareFacility"
        },
        "timeZoneUtcOffset": "-05:00"
    }
}

Hope it helps.

1 Like

Uoo! Thanks @Tosh_B , now works like a champ :smile:

Pleased to help…!
Happy building.!