ArchiveRestrictionInfo in REST/Agent APIs

Hi,

We are trying to transfer quotelines (products) from a quote to our system.

There is a thread with the answer explaining how to transfer quotelines and also with code snippet.

In the code `ArchiveRestrictionInfo` interface is mentioned but I couldn't figure out the 

corresponding web API (REST+Agent). 

 

Could you provide the steps with web API endpoints we suppose to use?

 

Thanks,

Peram

 

RE: ArchiveRestrictionInfo in REST/Agent APIs

Hi Peramanathan,

I beleive you are referring to the FindAgent.FindFromRestrictionsColumns query to look up the quotelines. 

The documentation shows an example what the body of the POST would look like.

Here are a couple real-world example that use the more advanced data aggregation capabilitites, invoking the saledynamicselection archive provider to get the sales forecast for the month. 

The example using the Find endpoint (with an orderby):

POST /Cust26759/api/v1/Agents/Find/FindFromRestrictionsColumnsOrderBy HTTP/1.1
Host: sod.superoffice.com:443
Authorization: Bearer 8A:Cust26759.AX...DnC
Accept: application/json
Content-Type: application/json

{
  "ProviderName": "saledynamicselection",
  "DesiredColumns": [
    "Sum(CurrencyConvert(amount;76)):HideDetail",
    "GroupBy(associate/fullName):Footer,HideDetail",
    "GroupBy(associate/personId):Footer,HideDetail",
    "GroupBy(associate/title):Footer,HideDetail"
  ],
  "OrderBy": [
    {
      "Name": "Sum(CurrencyConvert(amount;76)):HideDetail",
      "Direction": "DESC"
    }
  ],
  "Restrictions": [
    {
      "Name": "SelectionId",
      "Operator": "=",
      "Values": [
        "-1"
      ],
      "IsActive": true
    },
    {
      "Name": "associateId",
      "Operator": "currentAssociate",
      "Values": [],
      "IsActive": true
    },
    {
      "Name": "date",
      "Operator": "lastMonth",
      "Values": [],
      "IsActive": true
    },
    {
      "Name": "saleStatus",
      "Operator": "oneOf",
      "Values": ["1","2"],
      "IsActive": true
    }
  ],
  "Entities": [
    "sale"
  ],
  "Page": 0,
  "PageSize": 100
}

 

This example uses the Archive endpoint:

POST /Cust26759/api/v1/Agents/Archive/GetArchiveListByColumns HTTP/1.1
Host: sod.superoffice.com:443
Authorization: Bearer 8A:Cust26759.AX...DnC
Accept: application/json
Content-Type: application/json

{
  "ProviderName": "saledynamicselection",
  "Columns": [
    "Sum(CurrencyConvert(amount;76)):HideDetail",
    "GroupBy(associate/fullName):Footer,HideDetail",
    "GroupBy(associate/personId):Footer,HideDetail",
    "GroupBy(associate/title):Footer,HideDetail"
  ],
  "SortOrder": [
    {
      "Name": "Sum(CurrencyConvert(amount;76)):HideDetail",
      "Direction": "DESC"
    }
  ],
  "Restriction": [
    {
      "Name": "SelectionId",
      "Operator": "=",
      "Values": [
        "-1"
      ],
      "IsActive": true
    },
    {
      "Name": "associateId",
      "Operator": "currentAssociate",
      "Values": [],
      "IsActive": true
    },
    {
      "Name": "date",
      "Operator": "lastMonth",
      "Values": [],
      "IsActive": true
    },
    {
      "Name": "saleStatus",
      "Operator": "oneOf",
      "Values": ["1","2"],
      "IsActive": true
    }
  ],
  "Entities": [
    "sale"
  ],
  "Page": 0,
  "PageSize": 100
}

 

To get the quotelines, lets deconstruct the code in the referenced thread:

The example using the Find endpoint:

POST /Cust26759/api/v1/Agents/Find/FindFromRestrictionsColumns HTTP/1.1
Host: sod.superoffice.com:443
Authorization: Bearer 8A:Cust26759.AX...DnC
Accept: application/json
Content-Type: application/json

{
  "ProviderName": "QuoteLine",
  "DesiredColumns": [
    "name",
    "productFamilyKey",
    "productCategoryKey",
    "productTypeKey"
  ],
  "Restrictions": [
    {
      "Name": "quoteAlternativeId",
      "Operator": "=",
      "Values": [
        "12" //THIS IS THE QUOTE ALTERNATIVE ID...delete this comment...
      ],
      "IsActive": true
    }
  ],
  "Page": 0,
  "PageSize": 100
}

 

And the result will contain the ArchiveColumns and what you are really interested in, the ArchiveRows array. There is also the RowsCount. 

{
  "TableRight": null,
  "FieldProperties": {},
  "ArchiveColumns": [
    {
      "DisplayName": "[SR_QUOTE_QUOTELINE_NAME]",
      "DisplayTooltip": "[SR_QUOTE_QUOTELINE_NAME_TOOLTIP]",
      "DisplayType": "string",
      "CanOrderBy": true,
      "Name": "name",
      "CanRestrictBy": true,
      "RestrictionType": "string",
      "RestrictionListName": null,
      "IsVisible": true,
      "Width": "60%",
      "IconHint": "Products",
      "HeadingIconHint": ""
    },
    {
      "DisplayName": "[SR_QUOTE_QUOTELINE_PRODUCTFAMILYKEY]",
      "DisplayTooltip": "[SR_QUOTE_QUOTELINE_PRODUCTFAMILYKEY_TOOLTIP]",
      "DisplayType": "string",
      "CanOrderBy": false,
      "Name": "productFamilyKey",
      "CanRestrictBy": true,
      "RestrictionType": "listExternal",
      "RestrictionListName": "Erpproductfamily",
      "IsVisible": true,
      "Width": "40%",
      "IconHint": "Products",
      "HeadingIconHint": ""
    }
  ],
  "ArchiveRows": [
    {
      "TableRight": {
        "Mask": "Select",
        "Reason": "[SR_QUOTE_NOTDRAFT]"
      },
      "FieldProperties": {},
      "EntityName": "quoteLineAll",
      "PrimaryKey": 3,
      "ColumnData": {
        "name": {
          "DisplayValue": "Sample product",
          "TooltipHint": "{quoteline_id=3}",
          "LinkHint": ""
        },
        "productFamilyKey": {
          "DisplayValue": "Products",
          "TooltipHint": "Product tag used for grouping and filtering in selections etc.",
          "LinkHint": ""
        }
      },
      "LinkHint": "productfamilykey=1&nav=quoteLine&quoteLine_id=3&PkName=quoteLineId",
      "StyleHint": ""
    },
    {
      "TableRight": {
        "Mask": "Select",
        "Reason": "[SR_QUOTE_NOTDRAFT]"
      },
      "FieldProperties": {},
      "EntityName": "quoteLineAll",
      "PrimaryKey": 4,
      "ColumnData": {
        "name": {
          "DisplayValue": "Sample services",
          "TooltipHint": "{quoteline_id=4}",
          "LinkHint": ""
        },
        "productFamilyKey": {
          "DisplayValue": "Services",
          "TooltipHint": "Services tag used for grouping and filtering in selections etc.",
          "LinkHint": ""
        }
      },
      "LinkHint": "productfamilykey=2&nav=quoteLine&quoteLine_id=4&PkName=quoteLineId",
      "StyleHint": ""
    }
  ],
  "RowCount": 2
}

Hope this helps!

Av: Tony Yates 24. feb 2020