You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

User Accept header for custom properties

In addition to the various query methods, you can use the HTTP Accept header field to select individual properties in the REST result.

$ curl -si -HX-User:admin -HX-Password:admin -H"Accept:application/json; properties=name,type" "http://localhost:8082/structr/rest/files?name=test1.txt;test2.txt"

Response:

HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=6a32plzqhbat13k60o0n3774a;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding, User-Agent
Transfer-Encoding: chunked
Server: Jetty(9.1.3.v20140225)

{
   "query_time": "0.017328418",
   "result_count": 2,
   "result": [
      {
         "name": "test1.txt",
         "type": "File"
      },
      {
         "name": "test2.txt",
         "type": "File"
      }
   ],
   "serialization_time": "0.006950845"
}

Please note that the properties list of the Accept header must not contain spaces.

Search results for "User Accept header for custom properties"

We could not find anything matching "User Accept header for custom properties" in our documentation. Please rephrase your search.

You can also ask your questions in the Structr Google Group or create a free account in the Structr Support Portal.
Click here to send feedback to the Structr team.