REQUEST A LIVE DEMO

Type Resource

Path : /v1/type/{type name?}

Description:

Use this resource to create a manage data types within your search engine. You can use this resource to create, update and delete types. Deleting a data type will remove all indexed documents from the search engine.

Parameters:

Name Value Description
name String The display name of the type
default_title_field String The name of the field to use as the value of “title” in search responses
default_display_field String The name of the field to use as the value of “display” in search responses.
mapping String elasticsearch style mapping definition or a DragonGlass type definition.

Code Sample:

curl -X GET http://api.dragonglass.me/v1/type --user username:password curl -X POST http://api.dragonglass.me/v1/type --user username:password -d ‘{“name”: “New Type”]} curl -X PUT http://api.dragonglass.me/v1/type/new-type--user username:password -d ‘{“name”: “Changed Type Name”} curl -X PATH http://api.dragonglass.me/v1/type/new-type--user username:password -d ‘{“default_title_field”: “name”} curl -X DELETE http://api.dragonglass.me/v1/type/new-type --user username:password

Success response code:

  • 200 for GET, PUT.
  • 204 WILL be returned for DELETE.
  • 201 WILL be returned for POST operations (if successful) with the new resource’s URL specified in the Location header.

Error response code:

Error Code Reason
401 You did not provide authorization credentials
403 The credentials you provided were incorrect or not recognized