Skip to main content

Notifications

Announcements

No record found.

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

Webhook for custom API raises error "Resource not found for the segment"

Posted on by 18
Hi everyone,
I am having trouble creating a webhook subscription for a custom API page in BC.
When calling //webhookSupportedResources/ I can clearly see my API, but when I post a subscription for that API I receive the /Resource not found for the segment/ error.

I copy/pasted all API details to avoid accidental typos, but that didn't help.
Am I missing a setup step that might be necessary to open custom APIs up for webhook subscription? Or is there something I need to include in AL in the page definition that will allow the page to be accessed?
 
I have no trouble subscribing to standard APIs, which excludes issues with my postman, or receiver URL or anything of that sort.
 
I'm definitely not excluding that I am making a stupid mistake somewhere, I just can't find it. Any help would be greatly appreciated.
 
Thanks community!
 
@Inge M. Bruvik I unfortunately can't find a way to respond to your comment, so I'm doing it from within the post. First of all thank you for your suggestion! I checked everything that you mentioned but unfortunately nothing applies to my API. Fro clarification purpose I will add the page definition for my /test/ API here:
 
page 71034 custCust
{
    APIGroup = 'APIGroup';
    APIPublisher = 'APIPublisher';
    APIVersion = 'v1.0';
    ApplicationArea = All;
    Caption = 'customer';
    DelayedInsert = true;
    EntityName = 'customer';
    EntitySetName = 'customers';
    PageType = API;
    SourceTable = Customer;
    ODataKeyFields = SystemId;
    DataAccessIntent = ReadOnly;
    Editable = false;
    layout
    {
        area(content)
        {
            repeater(General)
            {
                field(no; Rec./No./)
                {
                    Caption = 'No.';
                }
                field(name; Rec.Name)
                {
                    Caption = 'name';
                }
                field(systemId; Rec.SystemId)
                {
                    Caption = 'SystemId';
                }
            }
        }
    }
}
 
 
////
 
////
Categories:
  • AlexKlymenko Profile Picture
    AlexKlymenko 2 on at
    Webhook for custom API raises error "Resource not found for the segment"
    Also stuck today with the same issue.
    The findings are quite surprising.
     
    I created an API page with some entity names - here it is 'xxx'
     
    The API page is listed in webhookSupportedResources and is accessible and returns data (in this example empty array but still) without errors. The URL mentions the EntitySetName=xxxs which is fine/expected.
     
     
    But attempts to subscribe to exactly this URL resulted into errors "No HTTP resource was found that matches the request URI"
     
     
    At the same time tutorial https://fredborg.org/?p=914 works fine.
    But here API page was based on items
    and subscription was requested also for items
    Not sure how that tutorial worked, because if I change my 'xxxs' to 'items' it also 'works' - at least it doesn't complain on not found resource. Or if I change it to 'salesOrders'... to anything which matches one of the 'standard' shared webservices.

    What really helped - specifying the API publisher/group/version also in the URL of the request (not mentioned in the tutorial) 
     
  • NAV_with_Narang Profile Picture
    NAV_with_Narang 2,236 Super User 2024 Season 1 on at
    Webhook for custom API raises error "Resource not found for the segment"
    Hi @jakob - Were you able to solve the issue you've mentioned? I am kind of facing a similar one myself, was hoping you'd have found a solution
     
    Please do explain what did you change in your resource URL
  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    Webhook for custom API raises error "Resource not found for the segment"
    There are some expections where webhooks will not work for custom API

    Webhooks are not supported for APIs in the following cases:

    • The source table for the API page is a temporary table (SourceTableTemporary = true).
    • The API page has a composite key (for example, if ODataKeyFields consists of several fields or is missing, then the primary key for the source table consists of several fields).
    • The source table for the API page is a system table ("Table No." > 2000000000).
    • The API is declared through an API type query, for example, and not through an API type page.
    • The source table for the API page is Job Queue Entry ("Table No." = 472).
    Can any of this be valid for your case?
    You can find further documentation around this here:
     
    I  hope this can be of some assistance to you.
     

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans