MSGraph#

NAME#

Kernel::System::MSGraph - Microsoft Graph API request helper

DESCRIPTION#

Builds HTTP requests against Microsoft Graph (OAuth 2 bearer token, optional JSON decode, pagination NextLink).

PUBLIC INTERFACE#

new()#

Create an MSGraph backend object. Do not use it directly; use ObjectManager instead:

my $MSGraphObject = $Kernel::OM->Get('Kernel::System::MSGraph');

_GetGraphLogin()#

Retrieves login string for API call: If not ‘me’ or starting with ‘users/’ already, it will return ‘users/’ with login appended.

my $GraphLogin = $MSGraphObject->_GetGraphLogin(
    Login => 'someone@example.org',
);

ExecuteOperation()#

Executes a Graph operation and returns the (decoded) response.

my $Response = $MSGraphObject->ExecuteOperation(
    CommunicationLogObject    => $CommunicationLogObject,
    Host                      => 'graph.microsoft.com',
    Login                     => 'someone@example.org',
    OAuth2Token               => '...',
    Operation                 => '/messages/id',
    RequestType               => 'GET', # optional; POST, DELETE, etc. Defaults to GET
    RequestHeaders            => {}, # optional, headers
    RequestData               => ..., # optional, payload of request
    JSONDecodeResponseContent => 1, # optional, defaults to 1

    # Optional; link returned by Graph for pagination.
    # If given, parameter Operation will be ignored.
    # Only for request type GET.
    NextLink => 'https://...',

    Timeout             => 60, # optional, timeout for request, default: WebUserAgent::Timeout // 15
    Proxy               => '...', # optional, default: Config WebUserAgent::Proxy
    NoProxy             => '', # optional, default: Config WebUserAgent::NoProxy
    SkipSSLVerification => 0, # optional, default: Config WebUserAgent::DisableSSLVerification
);

Returns 1 if request was successful but did not return any content.