How to do it...

  1. Open the televisionShow folder in Visual Studio Code.
  2. In Explorer, create a new file name Television Show Api.al. In Editor, create a new API page, as follows:
page 50112 "Televison Show API"
{
PageType = API;
Caption = 'tvshows';
APIPublisher = 'mypublisher';
APIGroup = 'tvshowproject';
APIVersion = 'v1.0';
EntityName = 'televisionshow';
EntitySetName = 'televisionshows';
SourceTable = "Television Show";
DelayedInsert = true;

layout
{
area(Content)
{
repeater(GroupName)
{
}
}
}
}
You can use the tpage, Page of type API snippet to create the basic API page structure.
  1. Add the following fields to the repeater section of the new page:
field(Code; Code)
{
ApplicationArea = all;
}
field(Name; Name)
{
ApplicationArea = All;
}
field(Status; Status)
{
ApplicationArea = All;
}
field(Synopsis; Synopsis)
{
ApplicationArea = All;
}
  1. Now, press F5 to build and publish the application to your development sandbox.
  2. Once the application has been published, with your web browser, go to the following URL and take note of the id of the company in which you have created some Television Show entries. You'll need it in a moment:
https://api.businesscentral.dynamics.com/v1.0/<tenant name>/sandbox/api/v1.0/companies

Replace <tenant name> with the name of your Azure domain in which you created the Business Central sandbox. For example, if your Azure domain is myazuresub.onmicrosoft.com, then you would use the following URL: 

https://api.businesscentral.dynamics.com/v1.0/myazuresub.onmicrosoft.com/sandbox/api/v1.0/companies

Log in using the username and web services access keys that you created in the Enabling basic authentication recipe earlier in this chapter.

  1. Now, with your web browser, go to the following URL:
https://api.businesscentral.dynamics.com/v1.0/<tenant name>/sandbox/api/mypublisher/tvshowproject/v1.0
/companies(<id>)/televisionshows

Make sure to replace <tenant name> and <id> with the appropriate values.

Log in using the username and web services access key that you created in the Enabling basic authentication recipe earlier in this chapter. If you have some Television Show entries in your system, then you should see something similar to this:

If you have not yet created any Television Show entries in your system, then refer to the Assisted setup wizards recipe in Chapter 3, Let's Go Beyond, to see how to run a wizard to load some default television shows.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.41.214