end
end
- # curl -u admin:admin -v -X PUT http://localhost:9000/api/properties/foo?value=bar[&resource=<resource>]
+ # curl -u admin:admin -v -X POST http://localhost:9000/api/properties/foo?value=bar[&resource=<resource>]
def create
update
end
- # curl -u admin:admin -v -X POST http://localhost:9000/api/properties/foo?value=bar[&resource=<resource>]
+ # curl -u admin:admin -v -X PUT http://localhost:9000/api/properties/foo?value=bar[&resource=<resource>]
def update
key = params[:id]
bad_request('missing key') unless key.present?
public String getUrl() {
StringBuilder url = new StringBuilder();
url.append(PropertyQuery.BASE_URL);
- url.append("/").append(encode(key));
- url.append('?');
+ url.append("?id=").append(encode(key)).append("&");
appendUrlParameter(url, "value", value);
appendUrlParameter(url, "resource", resourceKeyOrId);
return url.toString();
@Override
public String getUrl() {
StringBuilder url = new StringBuilder(BASE_URL);
+ url.append('?');
if (key != null) {
- url.append("/").append(encode(key));
+ url.append("id=").append(encode(key)).append("&");
}
- url.append('?');
appendUrlParameter(url, "resource", resourceKeyOrId);
return url.toString();
}
@Test
public void create() {
PropertyCreateQuery query = new PropertyCreateQuery("foo", "bar");
- assertThat(query.getUrl(), is("/api/properties/foo?value=bar&"));
+ assertThat(query.getUrl(), is("/api/properties?id=foo&value=bar&"));
assertThat(query.getModelClass().getName(), is(Property.class.getName()));
}
@Test
public void createForResource() {
PropertyCreateQuery query = new PropertyCreateQuery("foo", "bar", "my:resource");
- assertThat(query.getUrl(), is("/api/properties/foo?value=bar&resource=my%3Aresource&"));
+ assertThat(query.getUrl(), is("/api/properties?id=foo&value=bar&resource=my%3Aresource&"));
assertThat(query.getModelClass().getName(), is(Property.class.getName()));
}
}
\ No newline at end of file
@Test
public void test_global_property() {
PropertyQuery query = PropertyQuery.createForKey("myprop");
- assertThat(query.getUrl(), is("/api/properties/myprop?"));
+ assertThat(query.getUrl(), is("/api/properties?id=myprop&"));
assertThat(query.getModelClass().getName(), is(Property.class.getName()));
}
@Test
public void test_project_property() {
PropertyQuery query = PropertyQuery.createForResource("myprop", "my:resource");
- assertThat(query.getUrl(), is("/api/properties/myprop?resource=my%3Aresource&"));
+ assertThat(query.getUrl(), is("/api/properties?id=myprop&resource=my%3Aresource&"));
assertThat(query.getModelClass().getName(), is(Property.class.getName()));
}
}