WebApiClient

This is the core functionality of Xrm-WebApi-Client
No instantiation needed, it's a singleton.

Source:

Classes

Batch
BatchRequest
BatchResponse
ChangeSet
Response

Members

(static) WebApiClient.ApiVersion

Source:

The API version that will be used when sending requests. Default is "8.0"

(static) WebApiClient.Async

Source:

Set to false for sending all requests synchronously. True by default.

(static) WebApiClient.ClientUrl

Source:

Connection to use when being used in a single page app.

(static) WebApiClient.PrettifyErrors

Source:

Set to true for retrieving formatted error in style 'xhr.statusText: xhr.error.Message'. If set to false, error json will be returned.

(static) WebApiClient.ReturnAllPages

Source:

Checks for more pages when retrieving results. If set to true, all pages will be retrieved, if set to false, only the first page will be retrieved.

(static) WebApiClient.Token

Source:

Token to use for authenticating when being used in a single page app.

(static) WebApiClient.Version

Source:

Informs about which version of WebApiClient you're using

Methods

(static) AppendToDefaultHeaders(…var_args) → {void}

Source:

Function for building the set name of a given entity name.

Parameters:
Name Type Attributes Description
var_args Object <repeatable>

Headers as variable arguments

Returns:
Type
void

(static) Associate(parameters) → {Promise.<String>|String}

Source:

Associates given records in CRM.

Parameters:
Name Type Description
parameters Object

Parameters for associating records

Properties
Name Type Attributes Description
relationShip String

Name of relation ship to use for associating

source Object

Source entity for disassociating

Properties
Name Type Attributes Description
overriddenSetName String <optional>

Plural name of entity, if not according to plural rules

entityId String

ID of entity

entityName String

Logical name of entity, such as "account"

target Object

Target entity for disassociating

Properties
Name Type Attributes Description
overriddenSetName String <optional>

Plural name of entity, if not according to plural rules

entityId String

ID of entity

entityName String

Logical name of entity, such as "account"

async Boolean <optional>

True for sending asynchronous, false for synchronous. Defaults to true.

headers Array.<key:string, value:string> <optional>

Headers to attach to request

Returns:
  • Returns Promise if async, just String if sent synchronously.
Type
Promise.<String> | String

(static) Configure(configuration) → {void}

Source:

Applies configuration to WebApiClient.

Parameters:
Name Type Description
configuration Object

Object with keys named after WebApiClient Members, such as "Token"s

Returns:
Type
void

(static) Create(parameters) → {Promise.<String>|Promise.<object>|String|Object}

Source:

Creates a given record in CRM.

Parameters:
Name Type Description
parameters Object

Parameters for creating record

Properties
Name Type Attributes Description
entityName String

Entity name of record that should be created

overriddenSetName String <optional>

Plural name of entity, if not according to plural rules

entity Object

Object containing record data

async Boolean <optional>

True for sending asynchronous, false for synchronous. Defaults to true.

headers Array.<key:string, value:string> <optional>

Headers to attach to request

Returns:
  • Returns Promise if return=representation header is set, otherwise Promise. Just Object or String if sent synchronously.
    Type
    Promise.<String> | Promise.<object> | String | Object

    (static) Delete(parameters) → {Promise.<String>|String}

    Source:

    Deletes a given record in CRM.

    Parameters:
    Name Type Description
    parameters Object

    Parameters for deleting record

    Properties
    Name Type Attributes Description
    entityName String

    Entity name of records that should be deleted

    overriddenSetName String <optional>

    Plural name of entity, if not according to plural rules

    entityId String <optional>

    ID of entity to delete

    alternateKey Array.<property:string, value:string> <optional>

    Alternate key array for deleting record

    async Boolean <optional>

    True for sending asynchronous, false for synchronous. Defaults to true.

    headers Array.<key:string, value:string> <optional>

    Headers to attach to request

    Returns:
    • Returns Promise if async, just String if sent synchronously.
    Type
    Promise.<String> | String

    (static) Disassociate(parameters) → {Promise.<String>|String}

    Source:

    Disassociates given records in CRM.

    Parameters:
    Name Type Description
    parameters Object

    Parameters for disassociating records

    Properties
    Name Type Attributes Description
    relationShip String

    Name of relation ship to use for disassociating

    source Object

    Source entity for disassociating

    Properties
    Name Type Attributes Description
    overriddenSetName String <optional>

    Plural name of entity, if not according to plural rules

    entityId String

    ID of entity

    entityName String

    Logical name of entity, such as "account"

    target Object

    Target entity for disassociating

    Properties
    Name Type Attributes Description
    overriddenSetName String <optional>

    Plural name of entity, if not according to plural rules

    entityId String

    ID of entity

    entityName String

    Logical name of entity, such as "account"

    async Boolean <optional>

    True for sending asynchronous, false for synchronous. Defaults to true.

    headers Array.<key:string, value:string> <optional>

    Headers to attach to request

    Returns:
    • Returns Promise if async, just String if sent synchronously.
    Type
    Promise.<String> | String

    (static) Execute(request) → {Promise.<Object>|Object}

    Source:

    Executes the given request in CRM.

    Parameters:
    Name Type Description
    request Object

    Request to send, must be in prototype chain of WebApiClient.Requests.Request.

    Properties
    Name Type Attributes Description
    async Boolean <optional>

    True for sending asynchronous, false for synchronous. Defaults to true.

    headers Array.<key:string, value:string> <optional>

    Headers to attach to request

    Returns:
    • Returns Promise if async, just Object if sent synchronously.
      Type
      Promise.<Object> | Object

      (static) Expand(parameters) → {Promise.<Object>|Object}

      Source:

      Expands all odata.nextLink (deferred) properties for an array of records.

      Parameters:
      Name Type Description
      parameters Object

      Configuration for expanding

      Properties
      Name Type Attributes Description
      records Array.<Object>

      Array of records to expand

      async Boolean <optional>

      True for sending asynchronous, false for synchronous. Defaults to true.

      headers Array.<key:string, value:string> <optional>

      Headers to attach to request

      Returns:
      • Returns Promise if async, just Object if sent synchronously.
        Type
        Promise.<Object> | Object

        (static) GetApiUrl() → {String}

        Source:

        Gets the current base API url that is used.

        Returns:
        Type
        String

        (static) GetDefaultHeaders() → {Array.<{key: String, value:String}>}

        Source:

        Returns array of default headers.

        Returns:
        Type
        Array.<{key: String, value:String}>

        (static) GetSetName(entityName, overriddenSetNameopt) → {String}

        Source:

        Builds the set name of a given entity name.

        Parameters:
        Name Type Attributes Description
        entityName String

        Logical name of the entity, such as "account"

        overriddenSetName String <optional>

        Override set name if it can't be infered from plural rules

        Returns:
        Type
        String

        (static) Retrieve(parameters) → {Promise.<object>|Object}

        Source:

        Retrieves records from CRM

        Parameters:
        Name Type Description
        parameters Object

        Parameters for retrieving records

        Properties
        Name Type Attributes Description
        entityName String

        Entity name of records that should be retrieved

        overriddenSetName String <optional>

        Plural name of entity, if not according to plural rules

        queryParams String <optional>

        Query Parameters to append to URL, such as ?$select=*

        fetchXml String <optional>

        Fetch XML query

        entityId String <optional>

        ID of entity to retrieve, will return single record

        alternateKey Array.<property:string, value:string> <optional>

        Alternate key array for retrieving single record

        async Boolean <optional>

        True for sending asynchronous, false for synchronous. Defaults to true.

        headers Array.<key:string, value:string> <optional>

        Headers to attach to request

        Returns:
        • Returns Promise if asyncj, just Object if sent synchronously.
          Type
          Promise.<object> | Object

          (static) SendBatch(batch) → {Promise.<Object>|Object}

          Source:

          Sends the given batch to CRM.

          Parameters:
          Name Type Description
          batch Object

          Batch to send to CRM

          Properties
          Name Type Attributes Description
          async Boolean <optional>

          True for sending asynchronous, false for synchronous. Defaults to true.

          headers Array.<key:string, value:string> <optional>

          Headers to attach to request

          Returns:
          • Returns Promise if async, just Object if sent synchronously.
            Type
            Promise.<Object> | Object

            (static) SendRequest(method, url, payloadopt, parametersopt) → {Promise.<Object>|Object}

            Source:

            Sends request using given parameters.

            Parameters:
            Name Type Attributes Description
            method String

            Method type of request to send, such as "GET"

            url String

            Target URL for request.

            payload Object <optional>

            Payload for request.

            parameters Object <optional>

            Parameters for sending the request

            Properties
            Name Type Attributes Description
            async Boolean <optional>

            True for sending async, false for sync. Defaults to true.

            headers Array.<key:string, value:string> <optional>

            Headers for appending to request

            Returns:
            Type
            Promise.<Object> | Object

            (static) Update(parameters) → {Promise.<String>|Promise.<object>|String|Object}

            Source:

            Updates a given record in CRM.

            Parameters:
            Name Type Description
            parameters Object

            Parameters for updating record

            Properties
            Name Type Attributes Description
            entityName String

            Entity name of records that should be updated

            overriddenSetName String <optional>

            Plural name of entity, if not according to plural rules

            entityId String <optional>

            ID of entity to update

            alternateKey Array.<property:string, value:string> <optional>

            Alternate key array for updating record

            async Boolean <optional>

            True for sending asynchronous, false for synchronous. Defaults to true.

            headers Array.<key:string, value:string> <optional>

            Headers to attach to request

            Returns:
            • Returns Promise if return=representation header is set, otherwise Promise. Just Object or String if sent synchronously.
              Type
              Promise.<String> | Promise.<object> | String | Object

              Documentation generated by JSDoc 3.6.7 on Sat Nov 06 2021 00:44:45 GMT+0100 (Mitteleuropäische Normalzeit) using the docdash theme.