}
renderJSON(gson().toJson(subscriber));
}
public static void add(JsonObject body) throws ValidationException {
Subscriber subscriber = new Gson().fromJson(body, Subscriber.class);
validation.valid(subscriber);
if(validation.hasErrors()) {
throw new ValidationException(validation.errors());
}
subscriber.insert();
response.status = StatusCode.CREATED;
Map map = new HashMap();
map.put("id", subscriber.id);
String url = Router.reverse("api.Subscribers.get", map).url;// GET /clients/1541
response.setHeader("location", url);