<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="https://www.example.com/"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="https://query.example.com/search?q={search_term_string}"/>
<input itemprop="query-input" type="text" name="search_term_string" required/>
<input type="submit"/>
</form>
</div>
Just wondering if anyone else is looking into HTML as a
hypermedia type to produce/consume their machine-readable APIs.
Not doing it, but it doesn't sound unreasonable. If you use
XHTML templates with a form, then all your clients need to have
is an XML parser to consume what they need.
--Cheers,M
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.
> looked a little into what the HTML "vocabulary" would look like if it were "serialized" into JSONWhen you say "vocabulary" do you mean "How to describe forms, data and links" or do you mean the domain specific vocabulary for describing data such as medical records or weather data?
It seems as if you are comparing how to describe forms, data and links in various formats?
> it seemed to me that there was a lot of intersection between things like:> - for transitions, lots of intersection between siren's/hals'/swagger's/hydra's/mason's @action/operation and HTML5 <form>s and <a>s.> - for states, lots of intersection between siren's "properties", WADL's resources and <meta>, <span>, <div> tags in HTML5.Oh, yes, there sure is :-) But they all have their differences too depending on what context they are supposed to be used in:- Design time vs. run time: WADL, Swagger, Blueprint and others are meant for design time use whereas the others are for run time use.
- Layout features: some of them, mostly (only?) HTML, have built-in layout features for creating user interfaces dynamically at run time.- Hypermedia features: HAL, Siren, JSON-Collection, Mason, Hydra and HTML has varying levels of support for hypermedia. All have links, some have key/value forms and some have other features for describing payloads.
If you like linked data then JSON-LD is the obvious way to go. If you want bare bone simplicity then HAL it is. If you want richer hypermedia semantics (like for instance forms) then you need to look at the remaining formats.
> Right, what I'm trying to understand is:> (a) why/whether the basic hypermedia features of HTML are missing in these hypermedia types you mentionedMost of the API media types have about same hypermedia features as HTML - links plus some sort of forms plus structural data. Some of them supports more HTTP operations (PUT/DELETE) and payload formats (JSON) than HTML does. They are similar but not equivalent.> (b) why/whether we would need a different word to represent the same things if they represent the same concepts as HTMLI think the common understanding is that HTML *can* be used for APIs but it adds to much cruft to the payload. Most applications want their APIs to contain data and only data - not layout, scripts and images. For APIs the common trend has been to use JSON as the "lingua franca" for interoperability on the structural level.But then the idea of using hypermedia in APIs entered the scene and people wanted to put that into their JSON payload. Out of that came the various JSON based media types mentioned. None of this is governed by big corporations or standardization organizations, so it naturally evolves into different more or less equivalent formats depending of what flavors you like.If you like linked data then JSON-LD is the obvious way to go. If you want bare bone simplicity then HAL it is. If you want richer hypermedia semantics (like for instance forms) then you need to look at the remaining formats.So HTML has a focus on UI+hypermedia and can carry data for APIs too. The JSON formats has a focus on data+hypermedia and completely leaves out the UI part. APIs use JSON because it is simpler than HTML and very focused on, well, API data.
Sam:this list...<snip>- whether the field is required or not (e.g. <input required>)- min/max values (e.g. <input min=2 max=10>)- default values (e.g. <input value="foobar">)- readonly values (e.g. <input type="hidden">)- max/min length- pattern matching (e.g. <input pattern="/[1-9]/g">)- semantic auto-completing (e.g. first name, credit card numbers, etc) (e.g. <input type="tel">, <input type="text" autocomplete="firstName">)- enumerations (e.g. <select><option name='foo' value='bar'></select>)</snip>this is your list of features you want for APIs, right?
are you seeing these as "design-time" constraints (you know these when you code the client) or "run-time" constraints (the client reacts to these settings at runtime)?
> - whether the field is required or not (e.g. <input required>)> ...> - enumerations (e.g. <select><option name='foo' value='bar'></select>)> Do you call that UI?Not really. That describes data constraints (shcema) - in this context I consider UI as more about layout and visual style. But it is a grey zone. Especially auto completing which describes a UI feature (as I understand it).Anyway - there is support for most of these features in some of the formats.
PS: I see that http://sgo.to/rows/rows-json.html is not JSON and not
compatible with JSON.
That's why I try to explain, why starting with
JSON is usually better, instead of creating a new Dataformat :)
>
> {
> "one": [1, 3],
> "two": 2
> }
>
> So you usually end up with something like:
>
> {
On Fri, Jul 24, 2015 at 9:04 PM, mca <m...@amundsen.com> wrote:Sam:this list...<snip>- whether the field is required or not (e.g. <input required>)- min/max values (e.g. <input min=2 max=10>)- default values (e.g. <input value="foobar">)- readonly values (e.g. <input type="hidden">)- max/min length- pattern matching (e.g. <input pattern="/[1-9]/g">)- semantic auto-completing (e.g. first name, credit card numbers, etc) (e.g. <input type="tel">, <input type="text" autocomplete="firstName">)- enumerations (e.g. <select><option name='foo' value='bar'></select>)</snip>this is your list of features you want for APIs, right?not a complete list, but a good starting point to kick off a discussion. I'll try to write down what I think is missing in existing media types for APIs, compared to HTML.
> looked a little into what the HTML "vocabulary" would look like if it were "serialized" into JSONWhen you say "vocabulary" do you mean "How to describe forms, data and links" or do you mean the domain specific vocabulary for describing data such as medical records or weather data?
OK, as promised, here is a brain-dump:Not necessarily concise nor particularly well written, but has most of what's in my head of what's needed.
On Sun, Jul 26, 2015 at 9:43 PM, sgoto <samue...@gmail.com> wrote:OK, as promised, here is a brain-dump:Not necessarily concise nor particularly well written, but has most of what's in my head of what's needed.Reading this, it strikes me that what you really want is simply a way to specify schemas for the data. It seems to me you'd be better off just thinking about this as a schema representation and decoupling it from the hypermedia and API context.
Then, once you figure out what formalism for specifying schemas fits your needs (based on format, expressiveness) then you could come back and understand how that impacts your choice of hypermedia type.--Mike
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.
On Mon, Jul 27, 2015 at 9:38 AM, Michael Tiller <michael...@gmail.com> wrote:Reading this, it strikes me that what you really want is simply a way to specify schemas for the data. It seems to me you'd be better off just thinking about this as a schema representation and decoupling it from the hypermedia and API context.Yep, possibly.Just curious on terminology here: what distinction are you making between "schema representation" and "layout/presentation/navigation"? e.g. what's the goal of "schema representation" and is it any different than "navigating a programmer into filling a form/request"? Or are these two things trying to solve the same "goal" via different means?
On Mon, Jul 27, 2015 at 12:56 PM, sgoto <samue...@gmail.com> wrote:On Mon, Jul 27, 2015 at 9:38 AM, Michael Tiller <michael...@gmail.com> wrote:Reading this, it strikes me that what you really want is simply a way to specify schemas for the data. It seems to me you'd be better off just thinking about this as a schema representation and decoupling it from the hypermedia and API context.Yep, possibly.Just curious on terminology here: what distinction are you making between "schema representation" and "layout/presentation/navigation"? e.g. what's the goal of "schema representation" and is it any different than "navigating a programmer into filling a form/request"? Or are these two things trying to solve the same "goal" via different means?
Well, I'm currently working on an application where users provide me with information about their data. I convert that data into JSON Schema.
That gives me information on what you call "client-side dependencies", "client-side cardinality and group of fields" and "client-side validation".I've added a handful of additional fields to my JSON Schemas to provide additional information for the other things you are looking at. In particular, I have angular directives that (given an annotated JSON Schema) can generate (nested) forms for a given schema. I think that addresses your "basic <form> controls" (in the sense that it generates the UI). I think it also addresses your concerns about navigation since it allows me to define a specific ordering for information
For "client-side data loading", I'm not really sure what to say. I think that is beyond the scope of both schemas and hypermedia formats.The bottom line is that I'm fulfilling 5 of the 6 topics you talked about and it has nothing to do with the APIs or the hypermedia formats.
Granted, JSON schema is a content type, but as far as I know it is simply "application/json" and nothing more specialized than that...definitely not a hypermedia format. But because it is JSON, it can easily be embedded in any JSON format.--Mike
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.
Well, I'm currently working on an application where users provide me with information about their data. I convert that data into JSON Schema.Neat! Just curious: how is "users provide me with information about their data" done? Is that done programatically or manually? If the former, what goes as an input to your "convert the data into JSON Schema"?
That gives me information on what you call "client-side dependencies", "client-side cardinality and group of fields" and "client-side validation".I've added a handful of additional fields to my JSON Schemas to provide additional information for the other things you are looking at. In particular, I have angular directives that (given an annotated JSON Schema) can generate (nested) forms for a given schema. I think that addresses your "basic <form> controls" (in the sense that it generates the UI). I think it also addresses your concerns about navigation since it allows me to define a specific ordering for informationFor "client-side data loading", I'm not really sure what to say. I think that is beyond the scope of both schemas and hypermedia formats.The bottom line is that I'm fulfilling 5 of the 6 topics you talked about and it has nothing to do with the APIs or the hypermedia formats.Right, but say I wanted to re-use the solution to the "5 of the 6" problems I raised, I'd have to re-do that myself right (e.g. write the same parsers/converters you wrote, write the same "additional fields" you added, etc)?
Point being that, regardless at which level of the system this problem gets solved, what I am looking for is a "common convention" -- such that I don't have to re-invent what has already been done.
Question being: what are those conventions? And how well do they scale to a large number of applications (i.e. I believe you when you say you "fulfilled 5-6 for your specific application" - I'd like to see that applied to 100s applications)?