wfp-vam / databridgesapi Goto Github PK
View Code? Open in Web Editor NEWVAM DataBridges API client (WFP API Gateway)
VAM DataBridges API client (WFP API Gateway)
Revise the code as a library to get data from the various endpoints.
Also see #1
Hey Valerio,
Thank you for putting up examples on using the DataBridges API!
I believe the SamplePythonDataBridgesCall contains some code at the end that prevents it from compiling... (from line 200).
It seems to be a recipe for creating an API token from a key and a secret. A standalone example to do that with curl would be helpful in it's own right!
I think it should not be allowed to everyone to merge to the main branch without at least one reviewer approval.
Just as safety measure (:
Hi @ValerioGiuffrida ,
In the use-open-api-generator
branch, you will find the a complete auto-generated API client for the endpoints currently available in the swagger.json on catalog.api.wfp.org using https://openapi-generator.tech/docs/installation
In the README there is a code example that I have tested and works (you just need to place your token in the code). The auto-generated docs also show all the endpoints that have been immediately available. As you are familiar with the API, it should be easy to see the small changes one would need to make to point to different endpoints.
The advantage of this approach is that the code for all the endpoints is generated in seconds, and this could be done in all these languages. The code can be regenerated easily anytime endpoints change. The way one makes a call is a little clunky but not the end of the world.
If we were to go down this route, we would need to integrate this code with the functionality to refresh the token automatically. Probably not very difficult, but still something to spend some time on.
So my question here is: does this auto-generated client seem like a good way to go? If yes, the next step would be to look into the token refresh.
I tried to use the DataBridgesAPI from within a library that I publish to pypi. When I tried to upload to pypi, I got this error:
Error uploading to repository: https://upload.pypi.org/legacy/ - Client error '400 Invalid value for requires_dist. Error: Can't have direct dependency: "data-bridges-client@ git+https://github.com/WFP-VAM/DataBridgesAPI@dev#egg=data-bridges-client ; extra == 'wfp'"' for url 'https://upload.pypi.org/legacy/'
Please can you make a release to pypi of the latest code on the dev branch.
Installing it with command pip install pip@git+https://github.com/WFP-VAM/DataBridgesAPI
result in error (see log):
Collecting pip@ git+https://github.com/WFP-VAM/DataBridgesAPI
Cloning https://github.com/WFP-VAM/DataBridgesAPI to c:\users\alessandra.gherardel\appdata\local\temp\pip-install-_8ayfm8h\pip_c893ebad5a2a43b6ba81ef1d1b9d608e
Resolved https://github.com/WFP-VAM/DataBridgesAPI to commit 7d82d71eee5fd9e4a9bbe0899a6be29ccd547204
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Discarding git+https://github.com/WFP-VAM/DataBridgesAPI: Requested databridgesapi from git+https://github.com/WFP-VAM/DataBridgesAPI has inconsistent name: expected 'pip', but metadata has 'databridgesapi'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.