O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Advancing the REST API

This API will be far more useful and will provide us with the ability to add data so that the current web data feed is not the only data source.

The sample code in the georestwebservice project (of this chapter) is an updated version of the API with the new recordFeature method in the georestwebservice.dart file:

 @ApiMethod(path: 'record', method: 'POST')
QuakeResponse recordFeature(QuakeRequest request) {
  DaoQuakeAPI quakeAPI = new DaoQuakeAPI();
  quakeAPI.recordFeature(getFeatureAsJSON(request));

  QuakeResponse quakeResponse = new QuakeResponse();
  quakeResponse.result = "1";

  return quakeResponse;
}

This method will use the standard HTTP POST verb in order to receive the input from the client application. As the rpc package ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required