CostPortfolio

  • 15.5
This article is may not be up to date with the latest stable release of M4.

Description

The CostPortfolio endpoint provides the API consumer with access to methods pertaining to cost portfolios and related data objects. The endpoint allows consumers to load cost portfolios, add new cost portfolios, update cost portfolios, and delete cost portfolios.

Methods

URL base/CRM/CostPortfolio/Specification
Action GET
Description Returns a data dictionary that details the available web service methods related to the CostPortfolio endpoint.
Parameters None
 Returns  A JSON object with method descriptions
Sample Return Object
[
    {
        "HttpAction": "Get",
        "MethodName": "GetCostPortfolio",
        "Description": "Returns the record for a single 'CostPortfolio' given the passed in ID value (see Path).",
        "Path": "/CostPortfolio/GetCostPortfolio/25032"
    },
    {
        "HttpAction": "Post",
        "MethodName": "GetCostPortfoliosByName",
        "Description": "Returns all 'CostPortfolio' records where Name matches the passed in Name value.",
        "Format": {
            "Name": "Standard"
        }
    },
    {
        "HttpAction": "Post",
        "MethodName": "AddCostPortfolio",
        "Description": "Creates the record for a single 'CostPortfolio' and returns the CostPortfolio object",
        "Format": {
            "Name": "Standard",
            "Description": "Standard Pricing"
        }
    },
    {
        "HttpAction": "Post",
        "MethodName": "UpdateCostPortfolio",
        "Description": "Updates the record for a single 'CostPortfolio' and returns the CostPortfolio object",
        "Format": {
            "ID": 601,
            "Name": "Standard",
            "Description": "Standard Pricing"
        }
    },
    {
        "HttpAction": "Get",
        "MethodName": "DeleteCostPortfolio",
        "Description": "Deletes the record for a single 'CostPortfolio' given the passed in ID value (see Path).",
        "Path": "/CostPortfolio/DeleteCostPortfolio/25032"
    }
]
URL base/CRM/CostPortfolio/GetCostPortfolio/ID
Action GET
Description Returns a CostPortfolio object when given an ID of a valid cost portfolio in the M4 database.
Parameters
Name Required? Type Description
ID Yes Integer An integer value representing the ID of a cost portfolio in the M4 database.
Returns A JSON CostPortfolio data object
Sample Return Object
{
    "ID": 601,
    "Name": "Standard",
    "Description": "Standard Pricing"
}
URL base/CRM/CostPortfolio/GetCostPortfoliosByName
Action POST
Description Gets a collection of CostPortfolio objects where the name matches the specified name.
Parameters
Name Required? Type Description
Name Yes String The name of the cost portfolio.
Sample JSON Package
{
    "Name": "Standard"
}
Returns A collection of JSON CostPortfolio data objects
Sample Return Object
[
    {
        "ID": 601,
        "Name": "Standard",
        "Description": "Standard Pricing"
    },
    {
        "ID": 602,
        "Name": "Standard",
        "Description": "Standard Pricing"
    }
]
Business Rules
Any violations of these business rules result in an appropriate error message being returned to the API consumer.
  • Name: must not be null or blank
URL base/CRM/CostPortfolio/AddCostPortfolio
Action POST
Description Adds the specified CostPortfolio object and returns the newly added CostPortfolio object.
Parameters
Name Required? Type Description
Name Yes String The name of the cost portfolio.
Description No String The description of the cost portfolio.
Sample JSON Package
{
    "Name": "Standard",
    "Description": "Standard Pricing"
}
Returns A JSON CostPortfolio data object
Sample Return Object
{
    "ID": 601,
    "Name": "Standard",
    "Description": "Standard Pricing"
}
Business Rules
Any violations of these business rules result in an appropriate error message being returned to the API consumer.
  • Name: must not be null or blank
URL base/CRM/CostPortfolio/UpdateCostPortfolio
Action POST
Description Updates the specified CostPortfolio object and returns the newly updated CostPortfolio object.
Parameters
Name Required? Type Description
ID Yes Integer The ID of the cost portfolio.
Name Yes String The name of the cost portfolio.
Description Yes String The description of the cost portfolio.
Sample JSON Package
{
    "ID": 601,
    "Name": "Standard",
    "Description": "Standard Pricing"
}
Returns A JSON CostPortfolio data object
Sample Return Object
{
    "ID": 601,
    "Name": "Standard",
    "Description": "Standard Pricing"
}
Business Rules
Any violations of these business rules result in an appropriate error message being returned to the API consumer.
  • ID: must not be null
  • Name: must not be null or blank
URL base/CRM/CostPortfolio/DeleteCostPortfolio/ID
Action GET
Description Deletes an CostPortfolio object when given an ID of a valid cost portfolio in the M4 database.
Parameters
Name Required? Type Description
ID Yes Integer An integer value representing the ID of a cost portfolio in the M4 database.
Returns A JSON data object
Sample Return Object
{
  "Message": "The CostPortfolio with ID [55] was deleted successfully."
}

Was this article helpful?

Related Articles