Configuring Your Function

blockspring.json is a configuration file which populates everything you see on your function's homepage. When you use the Blockspring CLI tool to build Blockspring functions locally, you'll see this file.

For instance, if you have the Blockspring CLI installed, go into your terminal and type blockspring new py "Best function ever". Enter into your freshly created "best-function-ever" directory and open blockspring.json. You should see:

{
  "title": "Best function ever",
  "description": "",
  "parameters": [
    {
      "type": "text",
      "label": "First Name",
      "name": "first_name",
      "help_text": "Enter your first name.",
      "default": "Paul"
    },
    {
      "type": "number",
      "label": "Age",
      "name": "age",
      "help_text": "Enter your age.",
      "default": 26
    }
  ],
  "is_public": true,
  "is_open_source": true,
  "language": "py"
}

Here's what each part of this file does:

  • title: A title which appears on your function's homepage. Enter a string here.
  • description: A description which appears underneath the title on your function's homepage. This can be a string written in markdown.
  • parameters: An array of objects. Each object contains data about an input parameter and how it should render on the function's homepage. The following keys are available for each parameter:
    • type: This determines the type of form input rendered for your parameter. For a list of available types, visit the Input Types reference page.
    • label: This determines the label for your parameter's form input. It can be a string with spaces.
    • name: This is the name of the parameter in your code with request.params. The name here and in your code should match exactly.
    • help_text: This is a short string which helps a user understand what input to provide on your function's form.
    • default: This populates your function's homepage form with a default value.
  • is_public: This flag sets the authorization setting for your function. If "true", your function is searchable and can be called by anyone. If "false", your function can only be accessed and run by you and collaborators you explicitly add. See Manage Collaborators for more info.
  • is_open_source: This flag determines whether others can see your function's code. If "true", your function is open-sourced. If "false", only you and collaborators you explicitly add can see your code.
  • language: This sets the language of your function initially. You should not change this after pushing.