365 business development logo

365 business API

The 365 business API app is the base library for all 365 business development app, based on the 365 business API services. The app is the base libary app to provide API communication capabilities.

Interfaces

The 365 business API app is created as base library to communicate with the 365 business API services. Therfor the app provides public interfaces to use for handling and consuming API services.

365 business API (Codeunit 5523562 - bdev.365 business API)

The bdev.365 business API codeunit object is the base component in consuming 365 business API services and providing the base communication.

Methods

The following methods are available:

Method name Description
CallApi(Text) Sending a GET request to the API service.
CallApi(Text, Text) Sending a POST request to the API service.
CallApi(Enum, Text, Text) Sending a request to the API service.
CallApi(Enum, Text, Text[10], Text) Sending a request to a specific API service version.
GetResponse(Record) Returns the content of the API Response.
GetResponse(JsonObject) Returns the content of the API Response as JSON Object.
IsSuccessful() Checks whether be the previous API call successful or not.
GetException(Dictionary of [Text, Text]) Returns the exception caused by previous API call.
GetExceptionMessage() Returns the exception message caused by previous API call.
GetExceptionStatus() Returns the exception status caused by previous API call.
GetApiVersion() Returns the currently used API Version.
GetApiVersion(Code) Returns the API Version a specific service.
GetMajorApiVersion() Returns the major version no. of the currently used API Version.
GetMajorApiVersion(Code) Returns the major version no. of a specific service API Version.
GetMinorApiVersion() Returns the minor version no. of the currently used API Version.
GetMinorApiVersion(Code) Returns the minor version no. of a specific service API Version.
GetBuildApiVersion() Returns the build version no. of the currently used API Version.
GetBuildApiVersion(Code) Returns the build version no. of a specific service API Version.
GetRevisionApiVersion() Returns the revision version no. of the currently used API Version.
GetRevisionApiVersion(Code) Returns the revision version no. of the currently used API Version.
SetApiVersion(Code, Text) Set the API Service Version to use in case of specific version used.

Data Type Management (Codeunit 5523565 - bdev.API DataType Mgmt.)

Exposes common functionalities to handle with API responses and requests. It also contains functionalities to handle JSON and Text objects.

Methods

The following methods are available:

Method name Description
GetInStreamFromBlobStorage(Codeunit, InStream) Initiate InStream object from Temp Blob codeunit to read data.
GetOutStreamFromBlobStorage(Codeunit, OutStream) Initiate OutStream object from Temp Blob codeunit to write data.
GetTextFromBlobStorage(Codeunit) Read content from Temp Blob Codeunit and return Text object.
SetTextToBlobStorage(Codeunit, Text) Write a text to Temp Blob Codeunit.
GetBase64Content(JsonObject, Text, Text, Text) Get base64 content of an API Response.
GetBase64Content(JsonObject, Text, Enum, Text) Get base64 content of an API Response.
TestJsonToken(JsonObject, Text) Test whether the specified JSON token exists or not.
GetJsonToken(JsonObject, Text) Retrieves the specified JSON token by given key name.
SelectJsonToken(JsonObject, Text) Retrieves the specified JSON token by given path.
ConcatenateText(Text, Text) Concatenate text with whitespace in between.
ConcatenateText(Text, Text, Text) Concatenate text with specific merge text in between.

Exception (Codeunit 5523566 - bdev.API Exception)

Represents the common exception response returned from 365 business API, containing TimeStamp, ErrorCode and Message. Additional values are allowed and will be stored in a property directory.

Methods

The following methods are available:

Method name Description
Exception(HttpResponseMessage) Constructor method to extract information from HttpResponseMessage object.
Exception(Text) Constructor method to extract information from JSON string.
Exception(JsonObject) Constructor method to extract information from JSON object.
Set(Text, Text) Assigning the value to given key name.
Get(Text) Returns the value for requested key name, if present.
Get(Dictionary of [Text, Text]) Returns all properties from the exception object.
IsEmpty() Checks whether a exception object is empty or not.
TimeStamp() Returns the Timestamp from ExceptionResponse object.
TimeStamp(Text) Sets the timestamp of a ExceptionResponse object.
TimeStamp(DateTime) Sets an DateTime value as the timestamp of a ExceptionResponse object.
ErrorCode() Returns the Error Code from ExceptionResponse object.
ErrorCode(Text) Sets the Error Code of a ExceptionResponse object.
ErrorCode(Integer) Sets an Integer value as the Error Code from ExceptionResponse object.
Message() Returns the Message from ExceptionResponse object.
Message(Text) Sets the Message of a ExceptionResponse object.
Status() Returns the Status from ExceptionResponse object.
Status(Text) Sets the Status of a ExceptionResponse object.