How to add Custom Properties to Offer.

Create offer properties

POST https://svc-product-marketing-{envName}.azurewebsites.net/api/v1/OfferProperties

Body: 
{
  "vendorId": "",
  "offerId": "",
  "properties": [
    {
      "resellerId": "string",
      "fields": [
        {
          "key": "string",
          "value": "string"
        }
      ]
    }
  ]
}

Parameters description:

  • vendorId - GUID that identifies vendor
  • offerId - GUID that identifies offer
  • properties - array of custom properties to be added
  • resellerId - GUID that identifies resellerId
  • key - key that identifies the property. Can contain a string up to 100 alphanumeric chars.
  • value - value of the property. Can contain a string up to 100 alphanumeric chars.

Restrictions:

  1. It's not allowed to duplicate key within reseller and offer. The following payload is invalid:
"properties": [
    {
      "resellerId": "...",
      "fields": [
        {
          "key": "erpId",
          "value": "1233456789"
        },
		{
          "key": "erpId",
          "value": "987654321"
        }
      ]
    }
  1. If it forbidden to create property with key that is already existing in db. The bundle (offerId, resellerId, key) is unique.

The response contains offer with custom properties.

Edit offer properties

PUT https://svc-product-marketing-{envName}.azurewebsites.net/api/v1/OfferProperties

The body is the same as for POST method. Restrictions: If the property doesn't exist in db, it won't be added. The response contains offer with custom properties.

Get offer properties

GET https://svc-product-marketing-{envName}.azurewebsites.net/api/v1/OfferProperties/vendors/{vendorId}/offers/{offerId}/properties

Parameters description:

  • vendorId - GUID that identifies vendor
  • offerId - GUID that identifies offer

Example of response:

[
  {
    "resellerId": "9526b7b6-feac-4972-8259-3c135e51e19e",
    "fields": [
      {
        "key": "erpId",
        "value": "637291972186788707"
      },
      {
        "key": "materialId",
        "value": "dlfjdlkjfdk5777"
      }
    ]
  },
  {
    "resellerId": "b816525d-80ad-4c65-a8a3-b689cf0f3ddf",
    "fields": [
      {
        "key": "materialId",
        "value": "asddfgn"
      }
    ]
  }

Get offers by property value

GET https://svc-product-marketing-{envName}.azurewebsites.net/api/v1/OfferProperties/property/{property}/value/{value}/offers

Example of request:

api/v1/OfferProperties/property/materialId/value/asddfgn/offers

The response contains list of offers that have such property and the value of the property.

Get offers without specified property

GET https://svc-product-marketing-{envName}.azurewebsites.net/api/v1/OfferProperties/property/{property}/value/empty/offers

Example of request:

api/v1/OfferProperties/property/materialId/value/empty/offers

The response contains list of offers without specified property. This method was added by request of customer in order to find offers with the aim to add property in future.

Was this article helpful?

0 out of 0 found this helpful

Add comment

Please sign in to leave a comment.