1

I'm trying to update a customer in Microsoft Dynamics 365 Business Central using the API. I'm using Postman to make the call to the API

However, when I try to do the update I get the following error: -

"error": {
    "code": "BadRequest_ResourceNotFound",
    "message": "Resource not found for the segment 'customer'.  CorrelationId:  b5593eb6-2074-41fe-9106-d7bbdba8b452."
}

It creates a customer fine. And if I create a customer using Dynamics web UI then I can update it okay via the API. The problem only occurs if I create and Customer via the API and then try to update it.

This is the json that I'm using to create the customer

{
    "displayName": "Adatum Corporation",
    "type": "Company",
    "addressLine1": "192 Market Square",
    "addressLine2": "",
    "city": "Atlanta",
    "state": "GA",
    "country": "US",
    "postalCode": "31772",
    "phoneNumber": "",
    "email": "robert.townes@contoso.com",
    "website": "",
    "taxLiable": true,
    "blocked": " "
}

And this is the Json that I use to update

{
    "displayName": "Some other name"
}

Looked at it for hours and I just can't figure out what I'm doing wrong. Anyone got any ideas?

This is the endpoint that i'm using:

https://api.businesscentral.dynamics.com/v2.0/{id}/Production/api/v2.0/companies({id})/customers({customerid})
Shazoo
  • 685
  • 12
  • 25

1 Answers1

1

You have to use customers (plural form), then it should work. Web API Create and Update documentation.

POST businesscentralPrefix/companies({id})/customers

PATCH businesscentralPrefix/companies({id})/customers({id})

Normally this Resource not found for the segment 'X' error happens when X table/entity cannot be found.

  • this is the enpoint that I'm using: https://api.businesscentral.dynamics.com/v2.0/{id}/Production/api/v2.0/companies({id})/customers({customerid}) but still getting the same error – Shazoo Jun 01 '21 at 08:07