Data your way with Data Endpoints

Devin VisslailliDevin Visslailli

In this tutorial, we'll create a time-saving Data Endpoint. These endpoints allow you to see the exact data you want, with the precise query that you set!

Want to jump straight to the tutorial? Click here.

What is a Data Endpoint?

Data is wonderful. With data we can make predictions, provide useful (or useless) information, and even sort or filter a large blob of information based on what is relevant or necessary!

This is where I tell you how Data Endpoints are going to become your best friend. With Syncano Data Endpoints, you can take all of the data you have on Syncano, sort or filter it, and return the queried data to your application.

They are essentially custom data views that give you complete flexibility and custom preset queries, all accessible from an individual endpoint.

To learn more about Sockets, take a look at this guide.

Okay, but what can I do with them?

So maybe my monotonous explanation wasn’t enough for you, that’s fine. Here’s an example to show you exactly what I mean! Later we’ll put this example into practice.

Let’s say we’re a car dealership, and we have a bunch of data about the cars on our lot. For brevity’s sake, here are only some of the information fields available:

Let’s also pretend we’re somewhat mundane, and we don’t care about seeing the photo of the car or how many seats are in the car. Oh! We also only want to see cars that have less than 5,000 miles.

Now, using a Data Endpoint, we can say “Hey Syncano! I want to see all of my cars with mileage lower than 5,000. I also only want to see the car’s make, model, mileage, and color.”

I wouldn’t suggest actually yelling this at Syncano, there may be some strange looks from your coworkers (just kidding, we all work remotely now, right?).

So now every time you make a request to that Data Endpoint, you’ll only get the information you want to see. Easy, right? Now let’s stop fantasizing and actually do this!

Creating a Data Endpoint from the Syncano Dashboard

I’m going to break this down into simple steps, but first make sure you have a Syncano account sign up here, and then open up your Dashboard!

1. Adding the Data Endpoint Socket

Once you’ve opened your Dashboard, make sure you’re on the Sockets page, which you can find at the top of the left sidebar. If this is your first Socket, you may see a list of all of the available Sockets. If not, click the “Add” button in the top right corner!

Then “Add” a Data Endpoint. This will begin the customization and creation of your Data Endpoint!

This first screen will ask you for the “Name”, “Description”, and “Data Class” for your Data Endpoint.

Please fill out the information as seen below, with the name my_cars, and the example Data Class car:

Note: The Data Class car is an example Class created for you.

2. Creating a Data Class

In this tutorial, I won’t be able to explain exactly what a Data Class is, but in short it’s a blueprint for your data. Every object that you create using this Class will have the same fields.

Since we’re using an example Data Class, you won’t have to create any of the fields for your car data. We will change one thing though: let’s mark the “Filter” column for mileage so that we can filter the cars based on their mileage later!

3. Setting Up the Car Query

When you click the next button, you’ll see a screen that allows you to start setting up the query for your Data Endpoint.

Remember how we only care about make_name, model, mileage, and color? Let’s uncheck every other box so we don’t see those fields when we request this data.

Next, let’s also change the records number from 50 to 25. This is simply changing how many Data Objects will be returned when we send a request.

You’ll see you can also change the order of the cars, but we’ll keep the default, which is ordered by id and ascending.

Lastly, we need to set up that 5,000 mile query! If we don’t, we may see some cars that have -- oh I don’t know -- 138,000 miles (yes, that’s how many miles my car has).

Match the image below to properly set up the query!

Then confirm. Your Data Endpoint is ready! But… we still don’t have any data.

Creating Some Sample Data

As I said before, you can read up on Data Classes and Data Objects in our documentation, but for now I’ll just show you how to create some sample data for this Data Endpoint.

Since you’re probably still on the Sockets page, go ahead and click on the “Data Classes” link in the left sidebar. This is where all of your Data Classes are available.

Once you see your Classes, click on the small blue icon under Data Objects in the car row. Here is where you will view all of your Data Objects, unfiltered.

As expected, it’s completely empty! So let’s add some data. Click the “+” button in the top right corner.

Now, I’m not going to go through the process of adding many different objects, but for the purpose of this tutorial, add three Data Objects.

Make sure at least one has a mileage property that is over 5,000, and try filling in some of the fields that we chose to exclude! Here’s an example:

You’ve got some sample data and you’ve got a Data Endpoint. Now let’s see the results!

Take it for a Test Drive! wink

First, go back to the Sockets page. Again, you’ll find this link in the left sidebar. Once open, find your new Data Endpoint my_cars. On the right side, you’ll see a link that says “Preview”. This will give us a preview of our queried data!

Assuming you have some cars with the mileage over 5,000, you should see some data missing! Normally this would be a serious problem, but this is on purpose, so don’t worry.

You can also see the data in JSON format if you copy the provided link under the Data Endpoint name my_cars and just add your API Key as a URL parameter like this: ?api_key=your_api_key

If you want to access this Data Endpoint in your application, take a look here.

That’s all folks!

Congrats! I’m really proud of you for creating your very own personalized Data Endpoint. More short tutorials are coming soon, so stay connected with us!

Also feel free to ask any questions you have in the comments under this post, by joining our Slack community channel, or by writing to our support team at [email protected] Good luck!

Build powerful apps in half the time

Use our serverless platform to set up your backend in minutes.

Learn more

Developer Evangelist. Angular enthusiast, Early Adopter. New technology always inspires me, and I find myself constantly working to innovate and create integrations between the real world and tech.