Object Variables
What are objects and how to use them.
In this guide, we'll show you how to use objects.
Introduction
Before we begin, make sure you have:
- An active account on FluxyAPI.
- A project created (see Create your first project).
What Is an Object
Objects are data organized as key-value pairs that describe a thing.
Think of an object like a real thing, and the keys and values are its details. An example is a car, and its key-value pairs could be:
- color: blue
- speed: 120mph
- brand: FluxyAPI
Each car can have its own values for all of these.
How to Create an Object
Navigate to the correct project by clicking it in the top left corner of the dashboard.
Now that you're on the correct project, click the "Storage" tab in the sidebar.
Click "New Variable" in the top right of the storage page.
In the first box that appears, give your variable a name. Make this descriptive, not like my_var but something like fluxys_car!
Select "object" under the type options.
(Optional) If you would like, you can add key-value pairs that will be there from the beginning under the "Initial Value" option. Simply click "Add Key-Value Pair" and fill in the key and value. You can have multiple key-value pairs. You can also create nested keys using dot notation.
Click "Create Variable" and you're done. You've now successfully made an object in your FluxyAPI project!
Summary & Notes
You've now created an object successfully on your FluxyAPI dashboard!
You're limited to 1 MB per object variable. There's a depth limit of 10 for nesting.
To use variables in endpoints, see our Using Variables guide.
If you've got any questions or encounter any issues, feel free to join our Discord server, and we'll try to fix any issues you may face!
