Hi,
I am from C# programming background, though i have good knowledge on web services and REST APIs, I am very new to this Open data standards, especially i couldnt get ‘protobuf’.
Is there any C# developer who can guide me with sample line of codes to consume real-time Datasets/APIs?
Hi @Muthu, please make sure to read all the information we have on our website for developers:
Unfortunately we don’t offer coding guidance or assistance but hopefully another developer in our community will help you out. Also make sure to search our forum as I’m sure there are old threads that could be helpful.
I’m not a C# developer, but I can try to explain protobufs. Don’t think of it as an API, think of it as an SDK. You provide a specification (like GTFS-realtime) to protoc (the protobuf compiler) and it outputs a bunch of C# classes you can use to read a feed in that specification.
I received this question, for which the answer may also help you:
Is there any way to download GTFS-R (real time data) for all services (Bus/Train/Ferri) for all locations, because there is a limitations of max 60,000 calls to TfNSW API per day. If this real time data is available in our DB we can easily provide info to our customers.
GTFS-realtime is not an API, but a data format. GTFS-realtime is intended for getting the whole city at once. TfNSW has broken it up into one “download” for each mode (two for trains). One API call should get you all services for all locations for one mode.
Great.
Getting some clear picture now.
Can you please point out the realtime data API endpoints (you mentioned 2 for trains).
So the data downloaded will be in GTFS-R format and we need to parse and push into DB for our usage?
Then i need to find a C# formatter or converter.
There are two more APIs (one for vehicle positions and one for alerts).
The data downloaded will be in GTFS-realtime format and you need to parse and push into your DB for your usage.
You need to compile a C# reader as I said in Any C# Developer to guide me - #4 by jayen . It is unlikely you will find one. Also, I forgot to mention the protoc compiler minor version (e.g. 3.6) must match the protocol buffer library minor version. (The C# library you create may have a dependency on the protocol buffer library.)
I tried to generate c# code using protoc but getting error that “C# code generation only supports proto 3 syntax”. How can I generate C# classes using protoc for proto file?
That all sounds right, but the google one looks like it was last updated four years ago, and the briansrepo one looks like it was last updated two years ago. So while it’ll mostly work, you may have trouble to get any new fields that were recently added to the GTFS-realtime specification, and also the TfNSW extensions.