DeprecatedCustomer Affiliation API

Customer Affiliation API

Build and manage hierarchies, or affiliation trees, of customers represented in the platform as nodes.

The Customer Affiliation API is no longer supported for new integrations.

This API builds and manages hierarchies, or affiliation trees, of customers represented in the platform as "nodes."

There are two types of nodes that can appear in a user affiliation tree - "collection" and "user." A collection node is represented externally only as an object containing customers and/or other collection nodes - not represented as customers themselves. User nodes, on the other hand, are synonymous with current players/customers, but they can reside in an affiliation with either a collection node or a parent user node.

API Contingencies and Combinations:

The Customer Affiliation API supports the creation and maintenance of affiliation trees that represent hierarchies of related customers. As such, you do need to create the customers that populate these affiliations using the Standard Profile API.

This API provides a set of methods that do the following:

Create an Affiliation

Builds a new affiliation tree.

Endpoints for Create an Affiliation

This method offers the following endpoints:

REST Endpoints

POST /priv/v1/apps/:api_key/affiliations

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Create an Affiliation

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.

Request Object for Create an Affiliation

When this method runs, it passes in a request object that contains a user_affiliation object, as shown below:

JSON Request

{
    "user_affiliation": {
        "name": "ACME",
        "slug": "acme_inc”
    }
}

The object's attributes are detailed in the following table:

Request Attributes for User Affiliation

AttributeType
Required/Optional
Description
namestring
required
Name of the affiliation.
slugstring
required
Primary identifier for the user, or customer, affiliation. Format: Any alphanumeric character combined with underscores and dashes.

Response Object for Create an Affiliation

The response object returned by the method contains a user_affiliation object.

Consider the following sample:

JSON Response

{
    "user_affiliation": {
        "name": "ACME",
        "slug": "acme_inc”
    }
}

This response object contains attributes documented in the Response Attributes for User Affiliation table.

Statuses and Errors for Create an Affiliation

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
missing_dataOccurs when trying to create an affiliation without the correct parameters.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Retrieve All Affiliations

Returns all affiliations for an organization.

Endpoints for Retrieve All Affiliations

This method offers the following endpoints:

REST Endpoints

GET /priv/v1/apps/:api_key/affiliations

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Retrieve All Affiliations

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.

Request Object for Retrieve All Affiliations

Not applicable.

Response Object for Retrieve All Affiliations

The response object returned by the method contains a user_affiliation object.

Consider the following sample:

JSON Response

{
    "user_affiliation": {
        "id": 1,
        "name": "ACME",
        "slug": "acme_inc”
    }
}

The following table documents this object:

Response Attributes for User Affiliation

AttributeTypeDescription
idstringUnique user ID for a customer affiliation.
namestringName of the customer affiliation.
slugstringPrimary identifier for the customer affiliation. Format: Any alphanumeric character combined with underscores and dashes.

Statuses and Errors for Retrieve All Affiliations

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
missing_dataOccurs when trying to see a specific affiliation without the correct parameters.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Retrieve an Affiliation

Returns a specific affiliation by an ID or a slug.

Endpoints for Retrieve an Affiliation

This method offers the following endpoints:

REST Endpoints

GET /priv/v1/apps/:api_key/affiliations/:affiliation_slug_or_id

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Retrieve an Affiliation

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
affiliation_slug_or_idIdentifier for the affiliation. Can be specified with the slug, which is the primary identifier for the user, or customer, affiliation. (Format: All caps and underscores instead of spaces.) Can also be specified with the unique user ID for the customer affiliation.

Request Object for Retrieve an Affiliation

Not applicable.

Response Object for Retrieve an Affiliation

The response object returned by the method contains a user_affiliation object.

Consider the following sample:

JSON Response

{
    "user_affiliation": {
        "id": 1,
        "name": "ACME",
        "slug": "acme_inc”
    }
}

This response object contains the same attributes as the response object detailed in the Response Attributes for User Affiliation table.

Statuses and Errors for Retrieve an Affiliation

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
missing_dataOccurs when trying to see a specific affiliation without the correct parameters.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Create a Root Node

Creates a root node, which is the top-level parent in the affiliation tree.

Endpoints for Create a Root Node

This method offers the following endpoints:

REST Endpoints

POST /priv/v1/apps/:api_key/affiliations/:affiliation_slug_or_id

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Create a Root Node

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
affiliation_slug_or_idIdentifier for the affiliation. Can be specified with either the slug or the unique identifier of the affiliation. (Format: All caps and underscores instead of spaces.)

Request Object for Create a Root Node

When this method runs, it passes in a request object that contains a node object, as shown below:

JSON Request

{
    "node" : {
        "name": "Acme",
        "external_affiliation_type": "Company"
    }
}

The object's attributes are detailed in the Request Attributes for Node table.

Response Object for Create a Root Node

The response object returned by the method contains a node object.

Consider the following sample:

JSON Response

{
    "affiliation_type": "collection",
    "external_affiliation_type": "Company",
    "id": "729d9366-8b5d-11e8-822e-b5fb60c05ac3",
    "name": "ACME"
}

The object's attributes are detailed in the Response Attributes for Node table.

Statuses and Errors for Create a Root Node

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
node_existOccurs when trying to create a new node whose name or slug name was already used by an existing node. In effect, node already exists.
missing_dataOccurs when trying to create a node without parameters.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Add a Collection Child Node to a Parent Collection Node

Creates a parent-child relationship between two nodes.

Endpoints for Add a Collection Child Node to a Parent Collection Node

This method offers the following endpoints:

REST Endpoints

POST /priv/v1/apps/:api_key/affiliations/:affiliation_slug_or_id

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Add a Collection Child Node to a Parent Collection Node

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
affiliation_slug_or_idIdentifier for the affiliation. Can be specified with either the slug or the unique identifier of the affiliation. (Format: All caps and underscores instead of spaces.)

Request Object for Add a Collection Child Node to a Parent Collection Node

When this method runs, it passes in a request object that contains a node object, as shown below:

JSON Request

{
    "node": {
        "name": "ACME Sales Team",
        "external_affiliation_type": "Division",
        "parent_id": "729d9366-8b5d-11e8-822e-b5fb60c05ac3"
    }
}

The object's attributes are detailed in the following table:

Request Attributes for Node

AttributeType
Required/Optional
Description
namestring
required
Name of the child node.
external_affiliation_typestring
required
Name of the type of group/affiliation. For example, "Company" or "Division."
parent_idstring
required
Unique customer ID of the parent node.

Response Object for Add a Collection Child Node to a Parent Collection Node

The response object returned by the method contains a node object.

Consider the following sample:

JSON Response

{
    "affiliation_type": "collection",
    "external_affiliation_type": "Division",
    "id": "7a987422-8b5e-11e8-9c5f-16f360c05ac3",
    "name": "ACME Sales Team",
    "parent_id": "729d9366-8b5d-11e8-822e-b5fb60c05ac3"
}

The following table documents this object:

Response Attributes for Node

AttributeTypeDescription
affiliation_typestringDefines the type of child node - collection or customer. In this case, always a collection.
external_affiliation_typestringName of the type of group/affiliation. For example, "Company" or "Division."
idstringUnique customer ID of the child node.
namestringName of the child node.
parent_idstringUnique customer ID of the parent node.

Statuses and Errors for Add a Collection Child Node to a Parent Collection Node

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
node_existOccurs when trying to add a node to a parent and that relationship already exists. In effect, user is already in this collection.
parent_does_not_existOccurs when trying to add a node without specifying the parent or by using the wrong parent ID.
argument_errorOccurs when trying to add a node to another node that is not a collection. In effect, parent must be a collection.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Add a Customer to a Parent Collection Node

Adds an existing customer to a parent collection.

Endpoints for Add a Customer to a Parent Collection Node

This method offers the following endpoints:

REST Endpoints

POST /priv/v1/apps/:api_key/users/:user_id/affiliations/:affiliation_slug_or_id

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Add a Customer to a Parent Collection Node

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
user_idInternal identifier for the customer within the SessionM Platform.
affiliation_slug_or_idIdentifier for the affiliation. Can be specified with either the slug or the unique identifier of the affiliation. (Format: All caps and underscores instead of spaces.)

Request Object for Add a Customer to a Parent Collection Node

When this method runs, it passes in a request object that contains a parent ID, as shown below:

JSON Request

{
    "parent_id": "7a987422-8b5e-11e8-9c5f-16f360c05ac3"
}

The parent_id attribute is a required string for a unique customer ID of the parent node.

Response Object for Add a Customer to a Parent Collection Node

The response object contains a status value-pair.

Consider the following sample:

JSON Response

{
    "status": "ok"
}

Statuses and Errors for Add a Customer to a Parent Collection Node

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
node_existOccurs when trying to add a node to a parent and that relationship already exists. In effect, user is already in this collection.
parent_does_not_existOccurs when trying to add a node without specifying the parent or by using the wrong parent ID.
argument_errorOccurs when trying to add a node to another node that is not a collection. In effect, parent must be a collection.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Delete a Child Customer from a Parent Node

Deletes the relationship between a child customer and its parent's collection.

Endpoints for Delete a Child Customer from a Parent Node

This method offers the following endpoints:

REST Endpoints

DELETE /priv/v1/apps/:api_key/users/:user_id/affiliations/:affiliation_slug_or_id

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Delete a Child Customer from a Parent Node

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
user_idInternal identifier for the customer within the SessionM Platform.
affiliation_slug_or_idIdentifier for the affiliation. Can be specified with either the slug or the unique identifier of the affiliation. (Format: All caps and underscores instead of spaces.)

Request Object for Delete a Child Customer from a Parent Node

When this method runs, it passes in a request object that contains a parent ID, as shown below:

JSON Request

{
    "parent_id": "7a987422-8b5e-11e8-9c5f-16f360c05ac3"
}

The parent_id attribute is an optional string for a unique customer ID of the parent node.

Response Object for Delete a Child Customer from a Parent Node

The response object contains a status value-pair.

Consider the following sample:

JSON Response

{
    "status": "ok"
}

Statuses and Errors for Delete a Child Customer from a Parent Node

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
parent_does_not_existOccurs when trying to remove a node from a collection without specifying the parent. In effect, parent does not exist.
user_does_not_belong_to_this_parentOccurs when a node does not have a relationship with the specified parent. In effect, user does not belong to this parent.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Retrieve All Affiliations for a Customer

Returns all affiliations for a customer.

Endpoints for Retrieve All Affiliations for a Customer

This method offers the following endpoints:

REST Endpoints

GET /priv/v1/apps/:api_key/users/user_id?user[affiliations]=true

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Retrieve All Affiliations for a Customer

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
user_idInternal identifier for the customer within the SessionM Platform.
user[affiliations]=trueWhen set to true, retrieves the customer and traces their relationships in the affiliations tree, returning all of the customer's parents.

Request Object for Retrieve All Affiliations for a Customer

Not applicable.

Response Object for Retrieve All Affiliations for a Customer

In addition to a status value-pair for the transaction, the response object returned by the method contains a user object.

Consider the following sample:

JSON Response

{
    "status": "ok",
    "user": {
        "activated": false,
        "affiliations": [
            {
                "nodes": [
                    {
                        "affiliation_type": "collection",
                        "external_affiliation_type": "Division",
                        "id": "7a987422-8b5e-11e8-9c5f-16f360c05ac3",
                        "name": "ACME AMEA Sales Division",
                        "parent_id": "729d9366-8b5d-11e8-822e-b5fb60c05ac3"
                    },
                    {
                        "affiliation_type": "collection",
                        "external_affiliation_type": "Root Division",
                        "id": "729d9366-8b5d-11e8-822e-b5fb60c05ac3",
                        "name": "ACME Sales Team"
                    }
                ],
                "user_affiliation": {
                    "id": 1,
                    "name": "ACME",
                    "slug": "ACME"
                }
            }
        ],
        "available_points": 0,
        "id": "75af3d92-a216-11e7-8a5e-3b9f60c05ac3",
        "opted_in": true,
        "test_points": 0,
        "unclaimed_achievement_count": 0
    }
}

The following table documents this object:

Response Attributes for User (Customer)

AttributeTypeDescription
activatedbooleanDetermines if customer is verified.
nodesarrayList of nodes.
user_affiliationobjectCustomer affiliation object.
available_pointsintegerA customer's available points.
idstringUnique user ID of the customer.
opted_inbooleanIndicates whether a customer has opted into the rewards program.
test_pointsintegerAmount of points used on a test customer.
unclaimed_achievement_countintegerA count of the unclaimed achievements for a customer.

Statuses and Errors for Retrieve All Affiliations for a Customer

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
missing_dataOccurs when trying to see a specific affiliation without the correct parameters.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Retrieve Ancestors of a Customer within an Affiliation

Returns a list of ancestors - parent or grandparent nodes - for a specific customer.

Endpoints for Retrieve Ancestors of a Customer within an Affiliation

This method offers the following endpoints:

REST Endpoints

GET /priv/v1/apps/:api_key/users/:user_id/affiliations/:affiliation_slug_or_id

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Retrieve Ancestors of a Customer within an Affiliation

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
user_idInternal identifier for the customer within the SessionM Platform.
affiliation_slug_or_idIdentifier for the affiliation. Can be specified with either the slug or the unique identifier of the affiliation. (Format: All caps and underscores instead of spaces.)

Request Object for Retrieve Ancestors of a Customer within an Affiliation

Not applicable.

Response Object for Retrieve Ancestors of a Customer within an Affiliation

The response object returned by the method contains a nodes array.

Consider the following sample:

JSON Response

{
  "nodes": [
    {
        "affiliation_type": "collection",
        "external_affiliation_type": "Division",
        "id": "7a987422-8b5e-11e8-9c5f-16f360c05ac3",
        "name": "ACME Sales Division",
        "parent_id": "729d9366-8b5d-11e8-822e-b5fb60c05ac3"
    },
    {
        "affiliation_type": "collection",
        "external_affiliation_type": "Root Division",
        "id": "729d9366-8b5d-11e8-822e-b5fb60c05ac3",
        "name": "ACME Sales Team"
    }
  ],
  "user_affiliation": {
    "id": 1,
    "name": "ACME",
    "slug": "ACME"
  }
}

The attributes of this response are detailed within the Response Attributes for Node table and the Response Attributes for User Affiliations table.

Statuses and Errors for Retrieve Ancestors of a Customer within an Affiliation

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
missing_dataOccurs when trying to see a specific affiliation without the correct parameters.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Retrieve All Root Nodes

Returns all root nodes in an affiliation.

Endpoints for Retrieve All Root Nodes

This method offers the following endpoints:

REST Endpoints

GET /priv/v1/apps/:api_key/affiliations/:affiliation_slug_or_id/root_nodes

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Retrieve All Root Nodes

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
affiliation_slug_or_idIdentifier for the affiliation. Can be specified with either the slug or the unique identifier of the affiliation. (Format: All caps and underscores instead of spaces.)

Request Object for Retrieve All Root Nodes

Not applicable.

Response Object for Retrieve All Root Nodes

The response object returned by the method contains a user_affiliation object and a nodes array.

Consider the following sample:

JSON Response

{
  "user_affiliation": {
    "id": 13,
    "name": "ACME",
    "slug": "ACME"
  },
  "nodes": [
    {
      "id": "b4b2b67a-8b92-11e8-8167-244b89cb62b1",
      "name": "ACME",
      "external_affiliation_type": "organization",
      "affiliation_type": "collection"
    }
  ]
}

The attributes of this response are detailed within the Response Attributes for User Affiliations table and the Response Attributes for Node table.

Statuses and Errors for Retrieve All Root Nodes

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
missing_dataOccurs when trying to see a specific affiliation without the correct parameters.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Retrieve All Children

Returns all child nodes in a parent node.

Endpoints for Retrieve All Children

This method offers the following endpoints:

REST Endpoints

GET /priv/v1/apps/:api_key/affiliations/:affiliation_slug_or_id/:parent_id/children

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Retrieve All Children

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
parent_idInternal identifier for the parent node of the child nodes being retrieved.
affiliation_slug_or_idIdentifier for the affiliation. Can be specified with either the slug or the unique identifier of the affiliation. (Format: All caps and underscores instead of spaces.)

Request Object for Retrieve All Children

Not applicable.

Response Object for Retrieve All Children

In addition to a status key-value pair and a count integer indicating the number of children, the response object returned by the method contains a children array populated with multiple child nodes.

Consider the following sample:

JSON Response

{
    "status": "ok",
    "count": 1,
    "children": [
        {
            "id": "c65c98be-8b92-11e8-892f-a00d89cb62b1",
            "name": "ACME Sales Division",
            "external_affiliation_type": "division",
            "affiliation_type": "collection",
            "parent_id": "b4b2b67a-8b92-11e8-8167-244b89cb62b1"
        }
    ]
}

The children array contains a single child node, the attributes for which are detailed within the Response Attributes for Node table.

Statuses and Errors for Retrieve All Children

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
node_not_in_affiliationOccurs when using an ID that is not apart of the affiliation.
missing_dataOccurs when trying to see a specific affiliation without the correct parameters.
affiliation_disabledOccurs when the user affiliation feature is not enabled for an organization.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.