Resource Availability


#1

Hi Team,

How can i get all the resources real time availability??
I am currently calling get Resources api with embed “Bridge”.Also ,if i could get the start time of resource usage.

Please guide me through if this is the correct approach.


#2

If you want to know whether a resource is currently in use, you can get the list of resources and embed their bridges (as you are already doing).

GET https://fabman.io/api/v1/resources?account=<yourAccountId>&embed=bridge

Each resource’s bridge contains a inUse flag.

If you also want to know whether a machine is currently booked, you’ll have to fetch the list of all bookings that are active right now:

GET https://fabman.io/api/v1/bookings?account=<yourAccountId>&fromDateTime=2018-09-18T09%3A09&untilDateTime=2018-09-18T09%3A09

Pass the current local time (formatted as YYYY-MM-DDTHH:mm) to both fromDateTime and untilDateTime to get all bookings that overlap that time.

Do you mean the next upcoming booking for each resource? There’s no simple query for that yet, sorry. You’d have to fetch the list of upcoming bookings (just like the query above, but with untilDateTime set to end of day or something similar) and check for each resource whether there’s an entry.

We should probably offer a single query that combines the information from those requests – since that’s often needed. I’ll put it on our To-Do list.