New-NAVWebService
Creates a new Business Central web service.
Syntax
New-NAVWebService
-ObjectType <ObjectType>
-ObjectId <Int32>
-ServiceName <String>
[-Published <Boolean>]
[-ValidateAgainstTenant <TenantId>]
[-ServerInstance] <String>
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Use the New-NAVWebService cmdlet to create and optionally publish web services that are based on Business Central application objects. You can see which web services have already been created by running the Get-NAVWebService cmdlet.
In a multitenant deployment of Business Central, web services are created in the application database, and they apply to all tenants that are mounted against that Business Central Server instance.
Examples
EXAMPLE 1
New-NAVWebService -ServerInstance BC -ServiceName Customer -ObjectType Page -ObjectId 21 -Published 1
This example uses the New-NAVWebService cmdlet to create and publish a web service that is based on page 21, Customer Card.
Parameters
-Confirm
Prompts you for confirmation before executing the command.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Force
Forces the command to run without asking for user confirmation.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ObjectId
Specifies the ID of the object that you want to publish as a web service.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ObjectType
Specifies the type of the object that you want to publish as a web service. You can publish two types of web services from Business Central objects: SOAP Web Services and OData Web Services
With SOAP Web Services, you can publish either Business Central pages or codeunits.
With OData Web Services, you can publish either pages or queries.
For more information, see "Overview of Business Central Web Services" in the Developer and ITPro documentation for Business Central.
Type: | ObjectType |
Accepted values: | TableData, Table, Form, Report, Dataport, CodeUnit, XmlPort, MenuSuite, Page, Query, System, FieldNumber, LimitedUsageTableData, TablePage, PageExtension, TableExtension, Enum, EnumExtension, Profile, ProfileExtension, PermissionSet, PermissionSetExtension, ReportExtension |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Published
Specifies if the web service must be published immediately.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ServerInstance
Specifies the name of a Business Central Server instance, for example, BC or myinstance. You can specify either the full name of an instance, such as MicrosoftDynamicsNavServer$myinstance or the short name such as myinstance.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ServiceName
Specifies the name of the web service.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ValidateAgainstTenant
Specifies the ID of the tenant to be used for validation of the new web service. For example, validation verifies that object exists in the application. If validation fails, an error occurs. With a single-tenant deployment, use "default" as the value of this parameter.
Type: | TenantId |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Describes what would happen if you executed the command without actually executing the command.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Outputs
None
Notes
Because cmdlets do not execute application code, if there is any logic on application objects that are associated with creating or modifying web services from the client, be aware that the logic will not be executed when you run the cmdlet.