Get agreement products

Returns a collection of products connected to agreements.

Prerequisites

C#

To get products connected to agreement, first create an instance of CrayonApiClient and get the token using CrayonApiClient instance.

Next, prepare a filter AgreementProductFilter setting AgreementId.

Finally, call AgreementProducts.Get() method to get products of agreement by passing token and filter.

var filter = new AgreementProductFilter
{
        AgreementId = <agreement id> // should be the identifier of the agreement
};

var client = new CrayonApiClient("https://api.crayon.com/");
var token = client.Tokens.GetUserToken(clientId, clientSecret, userName, password).GetData().AccessToken;
var result = client.AgreementProducts.Get(token, filter);

Request

Request Syntax:

Method

Request URI

GET

https://api.crayon.com/api/v1/agreementproducts/

Request Parameters:

Name

Type

Description

agreementproductfilter

AgreementProductFilter

Filter products

Request Headers:

The following HTTP request headers are supported

Header

Type

Description

Authorization

string

Required. The authorization token in the form Bearer <token>.

Accept

string

Specifies the request and response type, “application/json”.

Content-Type

string

Specifies the media type of the resource, “application/json”.

Request Example:

POST $"https://api.crayon.com/api/v1/agreementproducts/"
Accept : application/json
Content-Type: application/json
Authorization : Bearer < Token >

Response

If successful, this method returns a AgreementProductCollection resource in the response body.

{
  "Publishers": [
    {
      "Key": "Microsoft",
      "DocCount": 5037,
      "Programs": [
        {
          "Key": "CSP-T2",
          "DocCount": 5037
        }
      ]
    }
  ],
  "Filter": {
    "AgreementTypeIds": null,
    "Page": 1,
    "PageSize": 1,
    "Search": null,
    "PriceListId": 0,
    "OrganizationId": 4702,
    "AgreementIds": null,
    "SearchDate": null,
    "Include": null,
    "Exclude": null
  },
  "Pools": [
    {
      "Key": "Azure",
      "DocCount": 4921
    },
    {
      "Key": "Cloud",
      "DocCount": 75
    },
    {
      "Key": "Non-specific",
      "DocCount": 41
    }
  ],
  "OperatingSystems": [
    {
      "Key": "Non-specific",
      "DocCount": 5037
    }
  ],
  "Offerings": [
    {
      "Key": "Microsoft",
      "DocCount": 4921
    },
    {
      "Key": "Non-specific",
      "DocCount": 71
    },
    {
      "Key": "NON-SPECIFIC",
      "DocCount": 33
    },
    {
      "Key": "ADDON",
      "DocCount": 12
    }
  ],
  "Levels": [
    {
      "Key": "0",
      "DocCount": 4281
    },
    {
      "Key": "Non-specific",
      "DocCount": 116
    },
    {
      "Key": "51200",
      "DocCount": 96
    },
    {
      "Key": "512000",
      "DocCount": 90
    },
    {
      "Key": "1024",
      "DocCount": 78
    },
    {
      "Key": "1024000",
      "DocCount": 78
    },
    {
      "Key": "5120000",
      "DocCount": 78
    },
    {
      "Key": "10240",
      "DocCount": 16
    },
    {
      "Key": "100",
      "DocCount": 12
    },
    {
      "Key": "1048576",
      "DocCount": 12
    },
    {
      "Key": "153600",
      "DocCount": 12
    },
    {
      "Key": "5242880",
      "DocCount": 12
    },
    {
      "Key": "5.0",
      "DocCount": 8
    },
    {
      "Key": "10240.0",
      "DocCount": 6
    },
    {
      "Key": "1048576.0",
      "DocCount": 6
    },
    {
      "Key": "153600.0",
      "DocCount": 6
    },
    {
      "Key": "5120",
      "DocCount": 6
    },
    {
      "Key": "51200.0",
      "DocCount": 6
    },
    {
      "Key": "512000.0",
      "DocCount": 6
    },
    {
      "Key": "5242880.0",
      "DocCount": 6
    },
    {
      "Key": "95",
      "DocCount": 6
    },
    {
      "Key": "1000",
      "DocCount": 4
    },
    {
      "Key": "1500",
      "DocCount": 4
    },
    {
      "Key": "16500",
      "DocCount": 4
    },
    {
      "Key": "20",
      "DocCount": 4
    },
    {
      "Key": "250",
      "DocCount": 4
    },
    {
      "Key": "25600",
      "DocCount": 4
    },
    {
      "Key": "266500",
      "DocCount": 4
    },
    {
      "Key": "500",
      "DocCount": 4
    },
    {
      "Key": "6500",
      "DocCount": 4
    },
    {
      "Key": "66500",
      "DocCount": 4
    },
    {
      "Key": "950000",
      "DocCount": 4
    },
    {
      "Key": "9950000",
      "DocCount": 4
    },
    {
      "Key": "10235",
      "DocCount": 3
    },
    {
      "Key": "153595",
      "DocCount": 3
    },
    {
      "Key": "51195",
      "DocCount": 3
    },
    {
      "Key": "511995",
      "DocCount": 3
    },
    {
      "Key": "1000000000",
      "DocCount": 2
    },
    {
      "Key": "102400",
      "DocCount": 2
    },
    {
      "Key": "1140",
      "DocCount": 2
    }
  ],
  "Languages": [
    {
      "Key": "All Languages",
      "DocCount": 3264
    },
    {
      "Key": "AU East",
      "DocCount": 179
    },
    {
      "Key": "AU Southeast",
      "DocCount": 179
    },
    {
      "Key": "BR South",
      "DocCount": 169
    },
    {
      "Key": "JA East",
      "DocCount": 108
    },
    {
      "Key": "JA West",
      "DocCount": 108
    },
    {
      "Key": "US East 2",
      "DocCount": 106
    },
    {
      "Key": "US West",
      "DocCount": 106
    },
    {
      "Key": "EU West",
      "DocCount": 101
    },
    {
      "Key": "AP Southeast",
      "DocCount": 93
    },
    {
      "Key": "EU North",
      "DocCount": 86
    },
    {
      "Key": "US Central",
      "DocCount": 86
    },
    {
      "Key": "US East",
      "DocCount": 86
    },
    {
      "Key": "US North Central",
      "DocCount": 86
    },
    {
      "Key": "Zone 1",
      "DocCount": 63
    },
    {
      "Key": "Zone 2",
      "DocCount": 63
    },
    {
      "Key": "AP East",
      "DocCount": 60
    },
    {
      "Key": "US South Central",
      "DocCount": 59
    },
    {
      "Key": "Zone 3",
      "DocCount": 35
    }
  ],
  "LicenseAgreementTypes": [
    {
      "Key": "Non-specific",
      "DocCount": 4921
    },
    {
      "Key": "Corporate",
      "DocCount": 116
    }
  ],
  "LicenseTypes": [
    {
      "Key": "Non-specific",
      "DocCount": 4921
    },
    {
      "Key": "Corporate",
      "DocCount": 75
    },
    {
      "Key": "CSP",
      "DocCount": 41
    }
  ],
  "ProductFamilies": [
    {
      "Key": "Virtual Machines",
      "DocCount": 1664
    },
    {
      "Key": "Cloud Services",
      "DocCount": 727
    },
    {
      "Key": "Storage",
      "DocCount": 650
    },
    {
      "Key": "Data Services",
      "DocCount": 412
    },
    {
      "Key": "Business Analytics",
      "DocCount": 354
    },
    {
      "Key": "Networking",
      "DocCount": 336
    },
    {
      "Key": "Azure App Service",
      "DocCount": 134
    },
    {
      "Key": "Linux Support",
      "DocCount": 130
    },
    {
      "Key": "CDN",
      "DocCount": 126
    },
    {
      "Key": "Non-specific",
      "DocCount": 116
    },
    {
      "Key": "Media",
      "DocCount": 108
    },
    {
      "Key": "Visual Studio",
      "DocCount": 57
    },
    {
      "Key": "App Services",
      "DocCount": 44
    },
    {
      "Key": "Cache",
      "DocCount": 34
    },
    {
      "Key": "Service Bus",
      "DocCount": 29
    },
    {
      "Key": "Identity",
      "DocCount": 24
    },
    {
      "Key": "RemoteApp",
      "DocCount": 16
    },
    {
      "Key": "Notification Hubs",
      "DocCount": 10
    },
    {
      "Key": "Recovery Services",
      "DocCount": 9
    },
    {
      "Key": "Batch",
      "DocCount": 8
    },
    {
      "Key": "Integration",
      "DocCount": 8
    },
    {
      "Key": "Data Management",
      "DocCount": 7
    },
    {
      "Key": "Azure IoT Hub",
      "DocCount": 6
    },
    {
      "Key": "Mobile Services",
      "DocCount": 6
    },
    {
      "Key": "Websites",
      "DocCount": 6
    },
    {
      "Key": "Xbox LIVE Game Services",
      "DocCount": 6
    },
    {
      "Key": "Scheduler",
      "DocCount": 4
    },
    {
      "Key": "SQL Reporting",
      "DocCount": 2
    },
    {
      "Key": "SQL StreamInsight",
      "DocCount": 2
    },
    {
      "Key": "Xbox Live Gaming Services",
      "DocCount": 2
    }
  ],
  "Programs": [
    {
      "Key": "CSP-T2",
      "DocCount": 5037
    }
  ],
  "ProductTypes": [
    {
      "Key": "Azure Consumption",
      "DocCount": 4921
    },
    {
      "Key": "Subscription",
      "DocCount": 69
    },
    {
      "Key": "Non-specific",
      "DocCount": 38
    },
    {
      "Key": "Subscription Add-On",
      "DocCount": 9
    }
  ],
  "PurchasePeriods": [
    {
      "Key": "Non-specific",
      "DocCount": 4996
    },
    {
      "Key": "1 Month(s)",
      "DocCount": 41
    }
  ],
  "PurchaseUnits": [
    {
      "Key": "Hours",
      "DocCount": 3285
    },
    {
      "Key": "GB",
      "DocCount": 835
    },
    {
      "Key": "Days",
      "DocCount": 318
    },
    {
      "Key": "Units",
      "DocCount": 134
    },
    {
      "Key": "Connections",
      "DocCount": 120
    },
    {
      "Key": "1 Month(s)",
      "DocCount": 116
    },
    {
      "Key": "Users",
      "DocCount": 45
    },
    {
      "Key": "1,000,000s",
      "DocCount": 17
    },
    {
      "Key": "Activities",
      "DocCount": 16
    },
    {
      "Key": "1M Queries",
      "DocCount": 8
    }
  ],
  "Versions": [
    {
      "Key": "",
      "DocCount": 5031
    },
    {
      "Key": "-",
      "DocCount": 3
    },
    {
      "Key": "0",
      "DocCount": 1
    },
    {
      "Key": "1",
      "DocCount": 1
    },
    {
      "Key": "ALL",
      "DocCount": 1
    }
  ],
  "Agreements": [],
  "Items": [
    {
      "UniqueId": "258726x476",
      "ProductVariant": {
        "Id": 258726,
        "Product": {
          "Id": 131312,
          "PartNumber": "d55b49e6-0f2b-4432-aca0-60661b6b6081",
          "ItemLegalName": "1 Gbps Connections",
          "ItemName": "1 Gbps Connections"
        },
        "PartNumber": "d55b49e6-0f2b-4432-aca0-60661b6b6081",
        "ProductName": "1 Gbps Connections -  (0 Months SA)",
        "Publisher": {
          "Id": 2,
          "Name": "Microsoft"
        },
        "Program": {
          "Id": 12,
          "Name": "CSP-T2"
        },
        "ProductFamily": {
          "Id": 451,
          "Name": "Networking"
        },
        "Language": {
          "Id": 64,
          "Name": "All Languages"
        },
        "Level": {
          "Id": 94,
          "Name": "0"
        },
        "ProductType": {
          "Id": 62,
          "Name": "Azure Consumption"
        },
        "Pool": {
          "Id": 9,
          "Name": "Azure"
        },
        "LicenseType": {
          "Id": 8,
          "Name": "Non-specific"
        },
        "LicenseAgreementType": {
          "Id": 18,
          "Name": "Non-specific"
        },
        "OperatingSystem": {
          "Id": 16,
          "Name": "Non-specific"
        },
        "Offering": {
          "Id": 12,
          "Name": "Microsoft"
        },
        "UnitCount": 0,
        "Version": "",
        "PurchaseUnit": "Connections",
        "AddDate": "0001-01-01T00:00:00Z",
        "DeleteDate": "0001-01-01T00:00:00Z",
        "PurchasePeriod": "1 Year"
      },
      "Agreement": {
        "Id": 476,
        "Name": "Azure Consumption"
      },
      "Name": "1 Gbps Connections - ",
      "PriceId": 397655,
      "SalesPrice": {
        "Value": 3070.6,
        "CurrencyCode": "SEK"
      },
      "PriceListName": "Azure_CSP_pricelist",
      "MonthMultiplier": 0,
      "PriceCalculationType": 1
    }
  ],
  "TotalHits": 5037
}

Response success and error codes:

Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters.

Error Codes

Description

200 Ok

The request has succeeded.

401 Unauthorized

The request requires user authentication. If the request already included Authorization credentials, then the 401 (Unauthorized) status code means that authorization has been refused for those credentials. It is a non-retryable error condition.

Sample code

List of products