Skip to main content

Notifications

Community site session details

Community site session details

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

Setting Parent Category via the api

(3) ShareShare
ReportReport
Posted on by 8

Hi,

I'm quite new to Business Central, but I need to be able to set the parent category via the API. I can create the categories, but not assign a parent.

I understand that I need to create a custom API endpoint to do that, which I’ve tried — but it seems to ignore my extension. I’ve played around with a few different AL files, but with no success!

I’ve been reading the Microsoft documentation, and while it seems straightforward to add a new item, I'm not sure how to expose an existing field like the parent category.

Any pointers would be greatly appreciated!

  • Suggested answer
    Sohail Ahmed Profile Picture
    3,301 on at
    Setting Parent Category via the api
    Maybe this will help you move forward.
     
    To set the Parent Category via API in Business Central, you're right — it’s not exposed in the default API, so you’ll need to:
     
    Steps:
     
    1. Extend the standard API page APIV2ItemCategories (Page ID: 5450) in your extension.
     
     
    2. Add the Parent Category field using addafter() or addlast() in your page extension.
     
     
    3. Make sure the Parent Category Code field is exposed as a GUID (SystemId) if you're working with the OData V4 endpoint.
     
     
    4. Publish your extension, and test using POST or PATCH to update the category.
     
     
     
    If your changes aren’t working:
     
    Double-check that your API page is marked with EntityName and EntitySetName.
     
    Make sure your modified page is included in the published app and is enabled in the Web Services list.
     
     
    You can also review Microsoft’s base extension here for reference:
    https://github.com/microsoft/ALAppExtensions/blob/main/Apps/W1/APIV2/app/src/pages/APIV2ItemCategories.Page.al
     
    Mark below checkbox to make this answer Verified if it helps you.
     
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    17,377 Super User 2025 Season 1 on at
  • Gerardo Rentería García Profile Picture
    19,825 Most Valuable Professional on at
  • Suggested answer
    YUN ZHU Profile Picture
    84,337 Super User 2025 Season 1 on at
    Setting Parent Category via the api
    Hi, You can copy the standard code below and add your new fields.
    PS: Dynamics 365 Business Central: Can we extend standard APIs? – Download Standard Source Code for APIs
     
    Hope this can give you some hints.
    Thanks.
    ZHU

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans