// ResetProperties resets the REST API properties to their default func resetProperties(c *clients.Client, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "DELETE", "/config/properties", nil) if err != nil { return err } return util.Execute(c, req, response) }
// SetPropertyValue sets a property of the REST API func setPropertyValue(c *clients.Client, propertyName string, property handle.Handle, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "PUT", "/config/properties/"+propertyName, property) if err != nil { return err } return util.Execute(c, req, response) }
// SetNamespace shows the namespaces used in queries func setNamespace(c *clients.Client, namespace handle.Handle, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "PUT", "/config/namespaces", namespace) if err != nil { return err } return util.Execute(c, req, response) }
// GetQueryOptions returns the named REST query options func getQueryOptions(c *clients.Client, name string, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "GET", "/config/query/"+name, nil) if err != nil { return err } return util.Execute(c, req, response) }
// StructuredSearch searches with a structured query func StructuredSearch(c *clients.Client, query handle.Handle, start int64, pageLength int64, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "POST", "/search?start="+strconv.FormatInt(start, 10)+"&pageLength="+strconv.FormatInt(pageLength, 10), query) if err != nil { return err } return util.Execute(c, req, response) }
// Search with text value func Search(c *clients.Client, text string, start int64, pageLength int64, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "GET", "/search?q="+text+"&start="+strconv.FormatInt(start, 10)+"&pageLength="+strconv.FormatInt(pageLength, 10), nil) if err != nil { return err } return util.Execute(c, req, response) }
// Initialize MarkLogic instance func initialize(ac *clients.AdminClient, license handle.Handle, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(ac, "POST", "/init", license) if err != nil { return err } return util.Execute(ac, req, response) }
// GetDatabaseProperties sets the database properties func GetDatabaseProperties(mc *clients.ManagementClient, databaseName string, propertiesHandle handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(mc, "GET", "/databases/"+databaseName+"/properties", nil) if err != nil { return err } return util.Execute(mc, req, propertiesHandle) }
// ListResources shows all the installed REST service extensions func listResources(c *clients.Client, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "GET", "/config/resources", nil) if err != nil { return err } return util.Execute(c, req, response) }
// DeleteResource removes a REST service func deleteResource(c *clients.Client, name string, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "DELETE", "/config/resources/"+name, nil) if err != nil { return err } return util.Execute(c, req, response) }
// ListExtensions shows all the installed REST extensions func listExtensions(c *clients.Client, directory string, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "GET", "/ext"+directory, nil) if err != nil { return err } return util.Execute(c, req, response) }
// DeleteExtensions shows all the installed REST extensions func deleteExtensions(c *clients.Client, directory string) error { req, err := util.BuildRequestFromHandle(c, "DELETE", "/ext"+directory, nil) if err != nil { return err } return util.Execute(c, req, nil) }
// SetQueryOptions shows all the installed REST extensions func setQueryOptions(c *clients.Client, optionsName string, options handle.Handle, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "PUT", "/config/query/"+optionsName, options) if err != nil { return err } return util.Execute(c, req, response) }
// DeleteAllQueryOptions removes all the installed REST query options func deleteAllQueryOptions(c *clients.Client, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(c, "DELETE", "/config/query", nil) if err != nil { return err } return util.Execute(c, req, response) }
// Verify that MarkLogic Server is up and accepting requests. // https://docs.marklogic.com/REST/GET/admin/v1/timestamp func timestamp(ac *clients.AdminClient, response handle.ResponseHandle) error { req, err := util.BuildRequestFromHandle(ac, "GET", "/timestamp", nil) if err != nil { return err } return util.Execute(ac, req, response) }
// GetServerProperties sets the database properties func GetServerProperties(mc *clients.ManagementClient, serverName string, groupID string, properties handle.ResponseHandle) error { if groupID == "" { groupID = "Default" } req, err := util.BuildRequestFromHandle(mc, "GET", "/servers/"+serverName+"/propertie?group-id="+groupID, nil) if err != nil { return err } return util.Execute(mc, req, properties) }
// Install the admin username and password, and initialize the security database and objects. func instanceAdmin(ac *clients.AdminClient, username string, password string, realm string, response handle.ResponseHandle) error { params := "?" params = util.RepeatingParameters(params, "admin-username", []string{username}) params = util.RepeatingParameters(params, "admin-password", []string{password}) params = util.RepeatingParameters(params, "realm", []string{realm}) req, err := util.BuildRequestFromHandle(ac, "POST", "/instance-admin"+params, nil) if err != nil { return err } return util.Execute(ac, req, response) }
// StructuredSuggestions suggests query text based off of a structured query func StructuredSuggestions(c *clients.Client, query handle.Handle, partialQ string, limit int64, options string, response handle.ResponseHandle) error { uri := "/suggest?limit=" + strconv.FormatInt(limit, 10) if options != "" { uri = uri + "&options=" + options } req, err := util.BuildRequestFromHandle(c, "POST", uri, query) if err != nil { return err } return util.Execute(c, req, response) }