Gandi

Table Of Contents

Previous topic

Catalog API Reference

Next topic

Gandi Certificate API

Catalog API FAQ

How-to price domains

Price a domain by TLD:

>>> api.catalog.list(apikey, {'product':{'type': 'domain', 'description': '.fr'}})

Price a domain by FQDN:

>>> api.catalog.list(apikey, {'product':{'type': 'domain', 'description': 'domain.fr'}})

Price a domain by FQDN and action (renew, create or transfer) (2-year purchase of example.com):

>>> product_spec = {
  'product' : {
    'description': 'example.com',
    'type': 'domain'
  },
  'action': {
    'name': 'create',
    'duration': 2
  }
}
>>> api.catalog.list(apikey, product_spec)
[{'action': {'name': 'create'},
'product': {'description': '.com', 'type': 'domain'},
'unit_price': [{'currency': 'EUR',
              'duration_unit': 'y',
              'grid': 'A',
              'id': 9980,
              'max_duration': 2,
              'min_duration': 1,
              'price': 12.0,
              'special_op': False}]}]

How-to price hosting products

Price all hosting products:

>>> product_spec = {
  'product' : {
    'description': ['memory', 'ips', 'disk', 'cores'],
    'type': 'hosting',
  },
  'action': {
    'name': 'create',
  }
}

>>> api.catalog.list(apikey, product_spec)
>>> [(x['product'], x['unit_price'][0]['price']) for x in api.catalog.list(apikey, product_spec)]
[({'description': 'disk', 'type': 'hosting'}, 0.17999999999999999),
  ({'description': 'ips', 'type': 'hosting'}, 2.0),
  ({'description': 'cores', 'type': 'hosting'}, 9.0),
  ({'description': 'memory', 'type': 'hosting'}, 0.015609400000000001)]