web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

ODATA API set empty value to GUID field

(0) ShareShare
ReportReport
Posted on by

Hello, I am a programmer trying to communicate with the Dynamics 365 Business Central ODATA API.
Perhaps my question relates to the ODATA protocol itself, but I don't understand how I can set a blank value for a field.

docs.microsoft.com/.../dynamics_item_update

Let's say I have an Item that says 'Item Category Code'='DIV'.
On the website I can see it as https://prnt.sc/22l7aat.
In the ODATA API I can get it as https://prnt.sc/22l7nei.
I can also update the 'itemCategoryId' field with a different GUID using PATCH request and that will work.

But when I try to set 'itemCategoryId'='' (an empty string), I get an 'Invalid Request Body' error.
If I set 'itemCategoryId'='00000000-0000-0000-0000-000000000000' (the value which is displayed in API if I specify an empty value on the site) I get an error 'The Item Category does not exist. Identification fields and values: {00000000-0000-0000-0000-000000000000}'.
If I specify 'itemCategoryId'='_x0020_' (a special empty string character), it gets the same error as above.
If I don't specify 'itemCategoryId', then this field won't be modified, because it's a PATCH, not a PUT request.

What should I specify to put an empty value in 'itemCategoryId'?

Kind regards!

I have the same question (0)
  • Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Normally if you don't want to specify a value for a non mandatory field, you can simply ignore it from the API JSON body you're passing.

    If you want to set a guid as empty, you can use (in C#) Guid yourFieldId = Guid.Empty;

  • Community Member Profile Picture
    on at

    I specifically want to specify an empty value. I use PHP.

    I tried 'itemCategoryId'='Guid.Empty' and got the error 'Invalid Request Body' again.
    'itemCategoryId'=null does not work also.
    'itemCategoryId'=false does not work also.
    'itemCategoryId'=0 does not work also.
    'itemCategoryId'='0' does not work also.
    'itemCategoryId'=-1 does not work also.
    'itemCategoryId'='-1' does not work also.
    'itemCategoryId'=' ' (one space) does not work also.
    'itemCategoryId'=' ' (one tab) does not work also.

    Did I write my question in the right place? Because I couldn't find any other way to communicate with API support.

  • Inge M. Bruvik Profile Picture
    1,161 Moderator on at

    What operation are you trying to do using the API. Updating or inserting a new Item record?

  • Community Member Profile Picture
    on at

    I am trying to update a record that has already been created. Now the record has a non-empty 'itemCategoryId' and I'm trying to assign an empty value.

  • Community Member Profile Picture
    on at

    No one knows the answer? Then can anyone advise me on who to approach with this question and who can help me with it?

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    I cannot help woth PHP. In C# what I've suggested works and creates a Guid like "{00000000-0000-0000-0000-000000000000}"

  • Suggested answer
    Community Member Profile Picture
    on at

    Just for the history: I opened an issue on github

    github.com/.../2154

    and they confirmed it was a bug and will fix it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,032 Super User 2026 Season 1

#2
Dhiren Nagar Profile Picture

Dhiren Nagar 1,049 Super User 2026 Season 1

#3
YUN ZHU Profile Picture

YUN ZHU 1,029 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans