dakboard / Cloud-Platform

Feature requests, enhancements and anything you'd like to see in DAKboard!
https://dakboard.com
167 stars 39 forks source link

JSON: Specify element in header #404

Closed RageAgainstTheVM closed 5 years ago

RageAgainstTheVM commented 5 years ago

Is it possible to create prompts for specific elements in the header when doing the HTTP/HTTPS GET? The API that I'd like to build for our office board requires an API key.

Example: URL: https://api.wmata.com/StationPrediction.svc/GetPrediction/B03

This is what the API expects: GET https://api.wmata.com/StationPrediction.svc/GetPrediction/B03 HTTP/1.1 Host: api.wmata.com api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Here's the output without being able to input the header element: { "statusCode": 401, "message": "Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API." }

Here's the expected output (when you can set elements in the header): Pragma: no-cache Arr-Disable-Session-Affinity: True Cache-Control: no-store, must-revalidate, no-cache Date: Wed, 14 Nov 2018 15:53:29 GMT X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Content-Length: 1098 Content-Type: application/json; charset=utf-8 Expires: Wed, 14 Nov 2018 15:53:30 GMT

{ "Trains": [{ "Car": "6", "Destination": "Wiehle", "DestinationCode": "N06", "DestinationName": "Wiehle-Reston East", "Group": "2", "Line": "SV", "LocationCode": "N03", "LocationName": "Greensboro", "Min": "BRD" }, { "Car": "8", "Destination": "Largo", "DestinationCode": "G05", "DestinationName": "Largo Town Center", "Group": "1", "Line": "SV", "LocationCode": "N03", "LocationName": "Greensboro", "Min": "2" }, { "Car": "8", "Destination": "Wiehle", "DestinationCode": "N06", "DestinationName": "Wiehle-Reston East", "Group": "2", "Line": "SV", "LocationCode": "N03", "LocationName": "Greensboro", "Min": "13" }, { "Car": "-", "Destination": "Largo", "DestinationCode": "G05", "DestinationName": "Largo Town Center", "Group": "1", "Line": "SV", "LocationCode": "N03", "LocationName": "Greensboro", "Min": "15" }, { "Car": "8", "Destination": "Wiehle", "DestinationCode": "N06", "DestinationName": "Wiehle-Reston East", "Group": "2", "Line": "SV", "LocationCode": "N03", "LocationName": "Greensboro", "Min": "18" }, { "Car": "-", "Destination": "Largo", "DestinationCode": "G05", "DestinationName": "Largo Town Center", "Group": "1", "Line": "SV", "LocationCode": "N03", "LocationName": "Greensboro", "Min": "27" }] }

AustinNiehaus commented 5 years ago

I would also like to see this feature for a similar reason. Some API's will require a key or additional settings to be submitted in the header. It would be great to see a section to add key/value pairs that would be submitted with the GET request.

red518irish commented 5 years ago

I would love to see this. I live in the DC metro area and in order to get the WMATA metro information to display I need this header added

danking6 commented 5 years ago

@RageAgainstTheVM, @AustinNiehaus, @red518irish thanks for the suggestions. We're looking into this as well as a direct integrations with WMATA and other metro areas. Are you looking just for next-train info for a specific station? If not, can you let us know what kind of data you'd like to see on DAKboard? Thanks!

RageAgainstTheVM commented 5 years ago

From our specific use case we had three DAKboards in different offices and we were trying to give employees who took the Metro a list of the next the next three trains for each station/line combination for that local office so they had an idea of when they should leave to catch the train. For example, I work in an office in Tyson's Corner, VA and I know that it takes me 6 minutes from office to metro stop. If the next train is in 5 minutes or less I know not to bother trying to rush out of the office. If 6 or 7 minutes I know to hustle. In practice this actually took a lot of stress out of mass transit commuting when somebody drops by your office to chat while you're packing. Nobody particularly minds waiting 3 minutes for the next train, but when you're on the platform for 12 minutes it gets frustrating.

While we ended up dropping our subscription to DAKboard when it expired (we ended up coding our own solution), I will give you a bit of advice if you're planning on offering a WMATA module instead of allowing key/value pairs: WMATA's API keys are limited to specific number of queries per day (I think last I looked it was 500 hundred, but that might be outdated). While this may seem like a lot, our first prototypes easily overran this API limit when we queried for each station on a minute update basis, and that was only three offices! We found that by creating a key for each office we stayed within limits, but I imagine if you offered a public module under a single key you'll find that your key will be insufficient for any real production volume, hence my suggestion to allow individual users to configure their own access (as each customer will provide their own key and usage will only affect them).

Because of the flexibility of our custom solution being able to specify particular API feeds, we were also able to expand our info screen to particular bus routes as well as start ingesting disruption info and alert employees who used public transit (and managers who wondered where late employees were!) of issues live.

danking6 commented 5 years ago

Hi all, we have added the option to set a custom header in the JSON/Fetch block:

Screenshot 2019-09-24 15 03 37

Let us know if you have any questions. Thanks.