Specifies additional text for the function, used to provide a brief description.
gitrepo
Specifies the Git repository address from which files for the function's code space can be pulled or pushed.
gitbranch
Specifies the Git repository branch name from which files for the function's code space can be pulled or
pushed. The default value is "main."
trigger
Specifies whether the function can be invoked from an Event Hub. If enabled, the function will be triggered
as soon as the Event Hub receives a message, which will then be forwarded to the function.
queue
Specifies the Event Hub ID that will trigger the function upon receiving a message. Please note that the
trigger field must be set to true to enable this functionality.
envars
Specifies the environment variables for the function in JSON format.
commands
Specifies additional build commands in JSON format for the function, typically used to install extra runtime
libraries needed during the build process.
testjson
Specifies the JSON input data that will be passed to the function during the test procedure.
memory
Specifies the memory size, in megabytes, allocated for the function. This value should be at least 128 MB.
timeout
Specifies the function's process timeout, in seconds.
staticport
Specifies the static port number for the function. If set to 0, the controller will dynamically assign a
port number starting at 32000. Once deployed, the function will retain the dynamically assigned port number
until it is deleted.
policy*
Specifies the S3 access policy for this function.
* Indicates a mandatory field. Code Snippets
Here are several code snippets provided for your direct use. Simply select your
preferred tool/language by clicking on it.
const apiUrl = "https://your_nexus_server_or_ip/api/v3/";
//JSON data to be sent
const data = {
"id": "V7f780c26d-xxxx-xxxx-xxxx-7a460e988afe",
"memory": 1024,
"timeout": 500,
"comments": "Updated Comments"
};
const requestOptions = {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-access-account": "YOUR_ACCOUNT_ID",
"x-access-authorization": "YOUR_ACCESS_KEY",
"x-secret-key": "YOUR_SECRET_KEY",
"x-api": "API_NAME",
"x-api-command": "API_COMMAND"
},
body: JSON.stringify(data),
};
fetch(apiUrl, requestOptions)
.then((response) => {
if (!response.ok) {
throw new Error("Connection error");
}
return response.json();
})
.then((data) => {
//process received JSON data
console.log(JSON.stringify(data, null, 4));
if (data.result == "OK") {
console.log("TASK SUCCESSFUL");
} else {
console.log("ERROR: " + data.message);
}
})
.catch((error) => {
console.log("Error: " + error);
});
API Request
Copy
import fetch from 'node-fetch';
/*
Using the following code as a workaround for self-signed certificate
errors is discouraged in production environments.
*/
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
const apiUrl = "https://your_nexus_server_or_ip/api/v3/";
//JSON data to be sent
const data = {
"id": "V7f780c26d-xxxx-xxxx-xxxx-7a460e988afe",
"memory": 1024,
"timeout": 500,
"comments": "Updated Comments"
};
const requestOptions = {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-access-account": "YOUR_ACCOUNT_ID",
"x-access-authorization": "YOUR_ACCESS_KEY",
"x-secret-key": "YOUR_SECRET_KEY",
"x-api": "API_NAME",
"x-api-command": "API_COMMAND"
},
body: JSON.stringify(data),
};
fetch(apiUrl, requestOptions)
.then((response) => {
if (!response.ok) {
throw new Error("Connection error");
}
return response.json();
})
.then((data) => {
//process received JSON data
console.log(JSON.stringify(data, null, 4));
if (data.result == "OK") {
console.log("TASK SUCCESSFUL");
} else {
console.log("ERROR: " + data.message);
}
})
.catch((error) => {
console.log("Error: " + error);
});
API Request
Copy
import requests
apiUrl = "https://your_nexus_server_or_ip/api/v3/"
#JSON data to be sent
data = {
"id": "V7f780c26d-xxxx-xxxx-xxxx-7a460e988afe",
"memory": 1024,
"timeout": 500,
"comments": "Updated Comments"
}
headers = {
"Content-Type": "application/json",
"x-access-account": "YOUR_ACCOUNT_ID",
"x-access-authorization": "YOUR_ACCESS_KEY",
"x-secret-key": "YOUR_SECRET_KEY",
"x-api": "API_NAME",
"x-api-command": "API_COMMAND"
}
###
# Using verify=False in the following code as a workaround for
# self-signed certificate errors is discouraged in production environments.
###
response = requests.post(apiUrl, headers=headers, json=data, verify=False)
#process received JSON data
ret = response.json()
print(ret)
if (ret['result'] == "OK"):
print("TASK SUCCESSFUL")
else:
print("ERROR: "+ret['message'])
API Request
Copy
require 'uri'
require 'net/http'
require 'json'
apiUrl = URI.parse("https://your_nexus_server_or_ip/api/v3/")
@data = {
"id": "V7f780c26d-xxxx-xxxx-xxxx-7a460e988afe",
"memory": 1024,
"timeout": 500,
"comments": "Updated Comments"
}.to_json
http = Net::HTTP.new(apiUrl.host, apiUrl.port)
http.use_ssl = true
###
# Using OpenSSL::SSL::VERIFY_NONE in the following code as a workaround for
# self-signed certificate errors is discouraged in production environments.
###
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
req = Net::HTTP::Post.new(apiUrl, initheader = {'Content-Type' => 'application/json'})
req['x-access-account'] = 'YOUR_ACCOUNT_ID'
req['x-access-authorization'] = 'YOUR_ACCESS_KEY'
req['x-secret-key'] = 'YOUR_SECRET_KEY'
req['x-api'] = 'API_NAME'
req['x-api-command'] = 'API_COMMAND'
req.body = @data
#make the api request
res = http.request(req)
# process received JSON data
ret = JSON.parse(res.body)
puts ret
if ret["result"] == "OK"
puts "TASK SUCCESSFUL"
else
puts "ERROR: "+ret["message"]
end
Successful Response
{
"result": "OK",
"payload": "The process was successfully completed"
}