src/bc_webservices

Search:
Group by:

A basic Microsoft Dynamics 365 Business Central authenticator and request library for Nim. Use this library to get data from the "Web Services" section of Business Central

Types

Auth = ref object
  client_id*: string
  tenant_id*: string
  environment*: string
  company*: string
  client_secret*: string
  scope*: string
  token*: Token
The Authentication settings for token generation and service auth
WebService = object
  name*: string
  filter*: string
  select*: string
  url*: string
A couple of Web Service parameters to build a web service url

Procs

proc makeRequest(auth: Auth; url: string): Response {....raises: [LibraryError,
    SslError, Exception, IOError, KeyError, ValueError, HttpRequestError,
    OSError, TimeoutError, ProtocolError, JsonError], tags: [TimeEffect,
    RootEffect, ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect],
    forbids: [].}
Makes the actual request to the Web Service. makeRequstByName calls this, but you could also use it to call a direct url if you wish
proc makeRequest(auth: Auth; webservice: var WebService): Response {....raises: [
    LibraryError, SslError, Exception, IOError, KeyError, ValueError,
    HttpRequestError, OSError, TimeoutError, ProtocolError, JsonError], tags: [
    TimeEffect, RootEffect, ReadDirEffect, ReadEnvEffect, ReadIOEffect,
    WriteIOEffect], forbids: [].}
Makes a request to the web service required by Name i.e. "workflowCustomers"