Hi Peter,

> Mac OS X 10.9.5 with Safari 7.1.2.

Thanks, I'll look into it.


> The first time I clicked on the link it asked me for a certificate,
> which seemed pointless to give it for API docs so I clicked Cancel.
> Then it displayed the error.

Perhaps you can try the version without SSL?

http://mr.dev.medvision360.org/mr/apidocs/#!/



> I had been hoping to see how a RESTful web service could be easy to
> use, since in my experience they?ve always been at least an order of
> magnitude more difficult than SOAP, at least with .NET systems where
> basically you just enter the URL and click a few buttons and hey
> presto, you have a bunch of proxy classes that you can easily program
> against with full type-safety ? as opposed to hours or days of
> reading docs, which are probably inaccurate, and trial-and-error
> tearing your hair out with frustration to find simple typos or type
> errors, wondering how you?ve suddenly time-travelled back into the
> 1970s. But maybe there are nice technologies out there for consuming
> RESTful services easily that I?ve never encountered, so I was
> intrigued to learn.
>
> I do like your description of the API of MediRecord, even if am
> sceptical about its ease of use ;-)

I agree with what you are saying and using a REST API directly in a 
application which is not a JavaScript application running in a web 
browser can be a challenge.

I absolutely feel the same about this and that's why we have a type safe 
Java (currently only Java but other languages are certainly possible) 
client library with those proxy classes you talk about.

We also have a PoC application which uses the JSON schemas to provide a 
similar 'type-safe' interface to JavaScript applications.

Also, all our documentation is generated from the same server source so 
it is always up to date and always matches reality.

Like I said, I share the same feelings about APIs as you do and I try my 
very best to make something which sucks less :)


Let me show some real Java examples of some of the integration tests we 
are using for MedRecord:


// basic configuration about where the server is and to set the
// authToken parameter so we can skip authentication on the test server
config = new ClientResourceConfig("https://mr.dev.medvision360.org/mr";);
config.addForcedQueryParameter("authToken", "helloletmeinplease");


// create an EHR
// this calls POST /ehr
EhrSetResource ehrResource = new EhrSetResource(config);
Id ehr = ehrResource.createEhr();


// store an OQ-45 score in the EHR
// (the score object is just a POJO containing the
// answers to the questionnaire)
// this calls POST /procedure/oq45/{ehrId}
Oq45SetResource resource = new Oq45SetResource(
        config,
        ehr.getId()
);
IdWithLink id = resource.create(score);


// retrieve the score we just stored
// this calls GET /procedure/oq45/{ehrId}/{id}
Oq45Resource resource = new Oq45Resource(
        config,
        ehr.getId(),
        id.getId()
);
Oq45Score score1 = resource.fetch();


All these calls communicate to MedRecord though the REST API using JSON 
documents.


The Javadocs for this client library can be found here:

https://javadoc.medvision360.org/model-client-jee/latest/latest/index.html?nl/medrecord/model/client/procedure/oq45/Oq45Resource.html

with the POJO containing the score answers here:

https://javadoc.medvision360.org/model-api-jee/latest/latest/index.html?nl/medrecord/model/model/ehr/observation/oq45/v1/Tree.html

This Tree object is automatically generated directly from the archetype 
and allows for a type safe way of accessing data.
This means the data is already validated on the client side even before 
it is send to the server. (It is using the Builder pattern for this)

For JavaScript (and other) clients we provide Json schemas which can be 
used to build and validate the data before sending it to the server.

http://mr.dev.medvision360.org/mr/schemas/objects/nl_medrecord_model_api_procedure_oq45_Oq45Score.json


BTW. for consuming REST APIs you should check out http://swagger.io/
It can generate those proxy classes for you. It is not what we are 
currently using because our solution predates swagger but I am 
considering upgrading :)


Ralph.

MedVision360


-- 
This e-mail message is intended exclusively for the addressee(s). Please 
inform us immediately if you are not the addressee. 

Reply via email to