Developer Settings

Overview

The Answer Generators that you write may need to access settings that common across all Answer Generators you create, for example, API keys. You can set properties in your Developer Settings page that will be transformed into a JSON object that is available to all your Answer Generators, even when being used by other users. As long as you are careful not to reveal these settings in your answers, these settings are not visible to users of your Answer Generators.

Updating Settings

In your Developer Settings page, you can set name-value pairs that will be transformed into your developer settings object according to theses rules:

Property Names

The following rules for analyzing each property name apply:

  1. A name that does not contain the . character, the value will be mapped to the name in the root object. So if you enter a row with the name mango and value fruit, the settings object will look like { "mango" : { "fruit" } }.
  2. Names that contain the . character will be treated as qualified names, each . creating another object in the hierarchy. So if you enter a row with the name x.y and the value z, the settings object will look like { "x" : { "y" : "z" } }.
  3. A name like x[] will be result in a mapping from x an array. The array will have all the values of the inputs with the same property name, in the same order as the inputs. So if you enter the name x[] and the value one for a row, then the name x[] and the value two for a subsequent row, the settings value will look like: { "x" : ["one", "two"] }.
  4. The special form value __IGNOREME__ can be used as a placeholder to force a property value to be an array even if there are no elements. The string itself does not get added to the array. So if you enter the name x and the value __IGNOREME__ in a row, the settings object will look like { "x" : [] }.

Property Values

All primitive values are saved as strings. Therefore, you may have to convert string property values to numbers and booleans in your Answer Generator scripts.

Accessing Developer Settings during Answer Generation

To read your developer settings in your Answer Generator, access the variable appropriate to the type of Answer Generator:

  • For URI Template Answer Generators, the developer settings object is available in the variable c.developerSettings
  • For Content Template Answer Generators, the developer settings object is available in the variable context.developerSettings
  • For Javascript Answer Generators, the developer settings object is available in the variable context.developerSettings, where context is the Query Context, passed in as the 3rd argument of generateResults(). See the source code of the Zillow Answer Generator for an example.

Security

Your developer settings are not directly visible to any other user, so you can store sensitive information like API keys there. However, when executing your Answer Generators, you should be careful not to expose sensitive information in your developer settings in the answers you produce.

Warning  At this time, we are not encrypting your developer settings in our database.