API with $filter


I’m trying to use the an external API that has a $filter parameter.
Link to the API doc: https://www.balena.io/docs/reference/api/overview/

For example, I’m trying to use: https://api.balena-cloud.com/v4/device?$filter=uuid%20eq%20’’

So it works - with just https://api.balena-cloud.com/v4/device

But as soon as I add $filter=uuid%20eq%20’[uuid]’ I’m getting some errors. (malformed URL) back from the API.
Seems like some characters are being replace and might not work right:

There is probably a simple solution to this, but I’d appreciate any help :slight_smile:


Can you post a screenshot of your setting?

I tried different variations, it seems that my issue would have something to do with how the characters are being replaced, specifically, the \ and the ’

This is just a poorly written API doc.
replace the \ after device by ?

1 Like

same result

Raw response for the API
Status code 400
“Malformed url: ‘/resin/device?$filter=uuid%20eq%20%E2%80%999d0fa03%E2%80%99’”

I think thatm my ’ didn’T get paste correctly

Awesome, this works! Thanks a lot :slight_smile:

I have one more question (it’s a little un-related).

When I did the lessons, when selecting an API parameter un the GUI, there wasn’t a “(path)” text next to the parameter name (here uuid) - Why is that?
Screen Shot 2019-12-06 at 10.21.36 PM

This is just to explain that this parameter is included in path (url) part and not set like other parameters or in body/json.

ok, I see. All good then :slight_smile:

Talking about body/json. I’m now trying to get this call into the API Connector

curl -X POST --header “Content-Type:application/json”
–header "Authorization: Bearer "
–data ‘{ “uuid” : “219135f833a9aabbe6c1e017eb30e29b”, “data” : { “serviceName” : “pihole” } }’

I tried this way, but it doest work. I believe it’s the --data that doesn’t get submitted properly.

Raw response for the API
Status code 400
At least one filter must be specified

Add header Content-Type with value to application/json

perfect, it works!

1 Like

Hello @tim5,

I want to add Balena to Bubble but I have troubles.
I added the API connector but I don’t know which authentification I have to choose and where find my token on Balena.

Could you help me please ?