Comments (7)
Hello,
Thank you for your kind words! There are already lists like https://github.com/public-apis/public-apis so I wouldn't be surprised if someone had already done it, needs a bit of searching however. Probably makes sense as its own list, and I would be happy to link to it from martian documentation.
Cheers
from martian.
I have written a library that can be used to authorize apis that need oauth2 tokens. I am currently converting the rest apis to martian. I have implemented github google xero. I will post a link once I am done converting.
from martian.
Some comments after using martian for a few days:
-
It is hard to find out if a rest api supports discovery with swagger/openid. This is not that something is mentioned in most api documents that i found.
-
Many openid connect providers have discoverable apis. Are they the same as openid/swagger specs? Seems to be a differwnt standard.. But perhaps it is the same?
-
When specing an api it would be nice to have a way to make requests when all specs are just s/Any and then infer the specs from actual api requests. I guess we could write an interceptor that does that.
-
Is it possible to have the api specs in edn files? This would make them more extendable. Also we could create a spec from a discoverable api endpoint once and then save it to edn. This way it can be easily extended at runtime.
from martian.
rest apis that work with oauth2 and martian: https://github.com/pink-gorilla/webly/tree/master/oauth2/src/modular/rest/martian
supports google, github, xero.
examples how to use the rest calls:
https://github.com/pink-gorilla/webly/tree/master/demo-rest/src/rest
What I dont like so much:
https://github.com/pink-gorilla/webly/blob/master/demo-rest/src/rest/google.clj
google has multiple api endpoint roots. I did add 3 google related martian "connection" exports.
They use the same oauth token store. But they just have different endpoint roots.
the xero web api uses two custom header interceptors (on top of the oauth token header).
a tenant-id header, which I create once (sort of a company with which to work). This works niceyl.
But then the query-api allows to search for changed data since a date. And for this interceptor
I did not manage to use a field from the request call.
https://github.com/pink-gorilla/webly/blob/master/oauth2/src/modular/rest/martian/xero.clj
from martian.
How can I rewrite this header-interceptor so that it
sets the "If-Modified-Since" header based on a parameter :modified-since
(->> (martian/response-for t :invoice-list-since
{:modified-since "2022-01-01T00:00:00"
:where "(Type == \"ACCREC\")"
:page 1})
:body
:Invoices
print-invoices)
(defn add-modified-since-header [dt]
{:name ::add-modified-since-header
:enter (fn [ctx]
(assoc-in ctx
[:request :headers "If-Modified-Since"]
dt))})
{:route-name :invoice-list-since
:summary "list invoices modified-since"
:method :get
:path-parts ["/api.xro/2.0/Invoices/"]
:query-schema {s/Any s/Any}
:produces ["application/json"]
:consumes ["application/json"]
:interceptors [(add-modified-since-header "2022-01-01T00:00:00")]}
from martian.
Any idea on my interceptor issue? Thanks
from martian.
Hi,
The ctx
contains a key :params
which contain the parameters passed to the martian call. You can use that to find your :modified-since
value.
e.g.
(def add-modified-since-header
{:name ::add-modified-since-header
:enter (fn [ctx]
(assoc-in ctx
[:request :headers "If-Modified-Since"]
(get-in ctx [:params :modified-since])))})
We have strayed a bit from the original issue topic of api lists, I will close this issue but feel free to open another one to deal with a particular topic, thanks for your feedback.
Cheers
from martian.
Related Issues (20)
- Hato support HOT 2
- martian-httpkit defaults to async HOT 3
- Support OpenAPI 3 servers specification HOT 6
- Make schema backend pluggable too HOT 1
- Support for Open API Spec in YAML in addition to JSON HOT 13
- disallowed-key / missing-required-key bipolar schema validation errors involving a path param HOT 9
- pagination HOT 2
- `response-for` gives me `nil` HOT 2
- How do I set withCredentials header? HOT 3
- How to HOT 7
- no routes found for my swagger OpenApi 3.0 definition HOT 2
- parameter not found in specific url HOT 2
- Automatically handle application/vnd.blah.foo+json custom content types HOT 3
- Martian could be more specific in the schemas HOT 1
- Add support for string format "date-time" leaf schema HOT 3
- Custom `:parameter-aliases` HOT 2
- Not an issue with martian; just don't know what I'm doing. HOT 2
- Can't get `respond-with-generated` or `response-generator` to work. HOT 3
- `response-for` returns `nil` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from martian.