How can I get prices and availabilities on a ConstructionGate
  • 29 Jun 2022
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

How can I get prices and availabilities on a ConstructionGate

  • Dark
    Light

Article Summary

Getting prices and availabilities on a ConstructionGate is almost the same as on a DistributionGate, but here you also have a priceFilter parameter for orderUnits and you can request the source

query q2 {
  productsearch (
      <Filter criteria>,
      priceCalculation: {deliveryType: ""<Delivery type>"", 
      project: ""<Project or construction site>""}) {
    content {
    id
    productOrderDetails {
      orderUnits(priceFilter:CHEAPEST) {
        source {
          code
          domain
          distributorNumberAtConstructor
          clientNumberAtDistributor
          type
        }
        name
        code
        quantityMin
        price {
          amount
          currency
        }
        contentUnit {
          name
          code
          contentUnitPerOrderUnit
        }
        availabilities {
          location { 
            name
            address { 
              street 
               city
               zip
             }
          }
          amount
        }
      }
    }
  }
}

The source tells us, where the price of the product on a ConstructionGate is coming from. A ConstrucitonGate can, but must not have prices. Let's assume, we have a ConstructionGate with code "contractor" with two connected Distributors (distributor1 and distributor). A response when you request without priceFilter might look like this:

"orderUnits": [
	{
		"source": {
			"code": "constructor",
			"domain": "contractor.dg.prod.promaterial.com",
			"distributorNumberAtConstructor": null,
			"clientNumberAtDistributor": null,
			"type": "CONSTRUCTOR"
		},
		"unit": {
			"name": "Kubikmeter",
			"symbol": "m³",
			"code": "QM-CUBIC_METER"
			},
		"price": {
			"amount": 655,
			"currency": "EUR"
		}
	},
	{
		"source": {
			"code": "distributor1",
			"domain": "distributor1.dg.prod.promaterial.com",
			"distributorNumberAtConstructor": 456,
			"clientNumberAtDistributor": 654,
			"type": "DISTRIBUTOR"
		},
		"unit": {
			"name": "Kubikmeter",
			"symbol": "m³",
			"code": "QM-CUBIC_METER"
			},
		"price": {
			"amount": 555,
			"currency": "EUR"
		}
	},
	{
		"source": {
			"code": "distributor2",
			"domain": "distributor1.dg.prod.promaterial.com",
			"distributorNumberAtConstructor": 789,
			"clientNumberAtDistributor": 987,
			"type": "DISTRIBUTOR"
		},
		"unit": {
			"name": "Kubikmeter",
			"symbol": "m³",
			"code": "QM-CUBIC_METER"
			},
		"price": {
			"amount": 444,
			"currency": "EUR"
		}
	}
]

Here you see all the prices per OrderUnit, including the one from the ConstructionGate. When you use a priceFilter, you will only get one price per orderUnit. The possible values for this parameter are CHEAPEST and AVERAGE. Both do not take the price of the constructor into consideration. Example responses:

CHEAPEST:

"orderUnits": [
	{
		"source": {
			"code": "distributor2",
			"domain": "distributor1.dg.prod.promaterial.com",
			"distributorNumberAtConstructor": 789,
			"clientNumberAtDistributor": 987,
			"type": "DISTRIBUTOR"
		},
		"unit": {
			"name": "Kubikmeter",
			"symbol": "m³",
			"code": "QM-CUBIC_METER"
			},
		"price": {
			"amount": 444,
			"currency": "EUR"
		}
	}
]
 

AVERAGE:

"orderUnits": [
	{
		"source": null
		"unit": {
			"name": "Kubikmeter",
			"symbol": "m³",
			"code": "QM-CUBIC_METER"
			},
		"price": {
			"amount": 499.5,
			"currency": "EUR"
		}
	}
]

As you can see, the latter does not return a source, because there is no source of an average price. In this example, we described the simple case, that we only have one orderUnit and that it is always the same. But we can also have the case, that we have different orderUnits per Distributor. You will always get all of them, respectively the cheapest or average over unit.

About the source in the response:
It includes

  • the code of the DistributionGate (or ConstrucitonGate)
  • the domain of the DistributionGate (or ConstrucitonGate)
  • the client number, that the constructor has at the distributor (clientNumberAtDistributor)
  • the client number, that the distributor has at the constructor (distributorNumberAtConstructor)
  • the type (DISTRIBUTOR or CONSTRUCTOR)

It does not return the name of the DistributionGate like "Distributor1 GmbH & Co Kg". You can get the name by using the connectedDistributionGates query:

query q2 {
  connectedDistributionGates{
    code
    name
  }
}

Was this article helpful?