MobilityData / gbfs-validator

The canonical GBFS validator. Maintained by the GBFS community, facilitated by MobilityData.
https://gbfs-validator.mobilitydata.org/
Apache License 2.0
19 stars 12 forks source link

HTTP API with Custom Header #160

Open nrohrbach opened 1 year ago

nrohrbach commented 1 year ago

Hi there

I try to access the Validator using the HTTP API. On the GBFS feed side a custom Header is required (Authorization=gbfs@bfe.admin.ch)

How do I set a custom header in the options of your HTTP API?

Best regards Nico

Hi Alban,

Thanks for reaching out! You can absolutely use the API, just note that it is not 100% production ready and may break. We also only have a limited number of requests available (125k/month). How often do you plan on requesting per day? We would ask that you include a user email in the header like so: User-Agent: <email_address>. There are no explicit permissions required on our end to give you access to the API, you should just be able to use it. Here is an example of how to use it with a curl command:

curl --location 'https://gbfs-validator.netlify.app/.netlify/functions/validator' \
--header 'accept: */*' \
--header 'Content-Type: application/json' \
--data '{
    "url": "https://dubai.publicbikesystem.net/customer/gbfs/v2/gbfs.json",
    "options": {
        "freefloating": false,
        "docked": false,
        "version": null,
        "auth": {
            "type": null,
            "basicAuth": {
                "user": null,
                "password": null
            },
            "bearerToken": {
                "token": null
            },
            "oauthClientCredentialsGrant": {
                "user": null,
                "password": null,
                "tokenUrl": null
            }
        }
    }
}'

Long term, we are planning to move the validator to something a more stable platform requiring API tokens in order to properly scale the tool.

Originally posted by @josee-sabourin in https://github.com/MobilityData/gbfs-validator/issues/95#issuecomment-1508706224

richfab commented 12 months ago

Hello @nrohrbach, Thank you for this question! Unfortunately, passing a custom header to validate a GBFS feed that requires authentication is not currently supported in the validator HTTP API. The code of the validator is open source so please don't hesitate to contribute to it if you have the resources. Thank you for your engagement in the GBFS community!