Custom Functions
Custom Functions Status
Returns the state of the Custom functions server. This includes whether it is enabled, upon which port it is listening, and where its root project directory is located on the host machine.
Operation is restricted to super_user roles only
operation (required) - must always be
custom_function_status
Body
Response: 200
Get Custom Functions
Returns an array of projects within the Custom Functions root project directory. Each project has details including each of the files in the routes and helpers directories, and the total file count in the static folder.
Operation is restricted to super_user roles only
operation (required) - must always be
get_custom_functions
Body
Response: 200
Get Custom Function
Returns the content of the specified file as text. HarperDB Studio uses this call to render the file content in its built-in code editor.
Operation is restricted to super_user roles only
operation (required) - must always be
get_custom_function
project (required) - the name of the project containing the file for which you wish to get content
type (required) - the name of the sub-folder containing the file for which you wish to get content - must be either routes or helpers
file (required) - The name of the file for which you wish to get content - should not include the file extension (which is always .js)
Body
Response: 200
Set Custom Function
Updates the content of the specified file. HarperDB Studio uses this call to save any changes made through its built-in code editor.
Operation is restricted to super_user roles only
operation (required) - must always be
set_custom_function
project (required) - the name of the project containing the file for which you wish to set content
type (required) - the name of the sub-folder containing the file for which you wish to set content - must be either routes or helpers
file (required) - the name of the file for which you wish to set content - should not include the file extension (which is always .js)
function_content (required) - the content you wish to save into the specified file
Body
Response: 200
Drop Custom Function
Deletes the specified file.
Operation is restricted to super_user roles only
operation (required) - must always be
drop_custom_function
project (required) - the name of the project containing the file you wish to delete
type (required) - the name of the sub-folder containing the file you wish to delete. Must be either routes or helpers
file (required) - the name of the file you wish to delete. Should not include the file extension (which is always .js)
Body
Response: 200
Add Custom Function Project
Creates a new project folder in the Custom Functions root project directory. It also inserts into the new directory the contents of our Custom Functions Project template, which is available publicly, here: https://github.com/HarperDB/harperdb-custom-functions-template.
Operation is restricted to super_user roles only
operation (required) - must always be
add_custom_function_project
project (required) - the name of the project you wish to create
Body
Response: 200
Drop Custom Function Project
Deletes the specified project folder and all of its contents.
Operation is restricted to super_user roles only
operation (required) - must always be
drop_custom_function_project
project (required) - the name of the project you wish to delete
Body
Response: 200
Package Custom Function Project
Creates a .tar file of the specified project folder, then reads it into a base64-encoded string and returns an object with the string, the payload and the file.
Operation is restricted to super_user roles only
operation (required) - must always be
package_custom_function_project
project (required) - the name of the project you wish to package up for deployment
skip_node_modules (optional) - if true, creates option for tar module that will exclude the project's node_modules directory. Must be a boolean.
Body
Response: 200
Deploy Custom Function Project
Takes the output of package_custom_function_project, decrypts the base64-encoded string, reconstitutes the .tar file of your project folder, and extracts it to the Custom Functions root project directory.
Operation is restricted to super_user roles only
operation (required) - must always be
deploy_custom_function_project
project (required) - the name of the project you wish to deploy. Must be a string
payload (required) - a base64-encoded string representation of the .tar file. Must be a string
Body
Response: 200
Last updated