API confuse, flow of requesting data for mobile app


#1

Hi everyone,

I’m new to transport NSW. I use Public Transport - Timetables - For Realtime API.
I’m working with mobile app project the require a transportation information like bus schedule inside the app.
I have read the documentation about the structures of the file.
When I try to request to the API, it will return to me in proto buf format. However I’m not sure how to convert it to format like JSON so it is readable to my app.

I try to request using curl through php and I can download the zip files contains all the txt files.
But how should I do it for the app? Should I download the zip file in server side and send to the mobile app and let the app unzip and read the txt file? or there is another way to do it?

I also confuse since some say I need to use protocol buffer to decode it, but what should I decode if I download it in zip format? or the protocol buffer help me to convert the zip to json?

Really appreciate if you could explain me the flow from requesting from API end point to the readable text like JSON in the app and also where is the request should start? is it from the client app? or server side like php?

Thank You


#2

GTFS Realtime and GTFS timetables don’t require protocol buffers only the realtime vehicle locations and trip positions is where protocol buffers are required. You can import each text file into a database and use PHP to extract the data


#3

Oh I see. So for example I request using php and import the txt into database. But since it’s not fixed timetable, I need to update my database over the time. So how should I do the update automatically over the time so I can get the realtime timetable ?

Thanks


#4

While you can definitely find out all you need about GTFS and GTFS realtime by searching the forums and the web you might want to consider some books.

There’s the GTFS and GTFS-realtime bundle over at https://gumroad.com/l/gtfsbundle which you might find valuable.