{
"id": string,
"branch": string,
"path": string
}
id * | Specifies the ID of the repository. |
branch * | Specifies the name of the branch. |
path * | Specifies the path of the folder. For example: /build. |
nexus --mode=cli \
--api=API_NAME \
--command=API_COMMAND \
--account=YOUR_ACCOUNT_ID \
--accesskey=YOUR_ACCESS_KEY \
--secretkey=YOUR_SECRET_KEY \
--data="{ \"id\": \"V7...\", \"branch\": \"develop\", \"path\": \"/build\" }"
curl -X POST \
-H "x-access-account: YOUR_ACCOUNT_ID" \
-H "x-access-authorization: YOUR_ACCESS_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-api: API_NAME" \
-H "x-api-command: API_COMMAND" \
-d "{ \"id\": \"V7...\", \"branch\": \"develop\", \"path\": \"/build\" }" \
https://your_nexus_server_or_ip/api/v3/
const apiUrl = "https://your_nexus_server_or_ip/api/v3/";
//JSON data to be sent
const data = {
"id": "V7dcf7bce3-xxxx-xxxx-xxxx-7e49xxxxx1148",
"branch": "develop",
"path": "/build"
};
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);
});
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": "V7dcf7bce3-xxxx-xxxx-xxxx-7e49xxxxx1148",
"branch": "develop",
"path": "/build"
};
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);
});
import requests
apiUrl = "https://your_nexus_server_or_ip/api/v3/"
#JSON data to be sent
data = {
"id": "V7dcf7bce3-xxxx-xxxx-xxxx-7e49xxxxx1148",
"branch": "develop",
"path": "/build"
}
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'])
require 'uri'
require 'net/http'
require 'json'
apiUrl = URI.parse("https://your_nexus_server_or_ip/api/v3/")
@data = {
"id": "V7dcf7bce3-xxxx-xxxx-xxxx-7e49xxxxx1148",
"branch": "develop",
"path": "/build"
}.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
{
"result": "OK",
"payload": "The process was successfully completed"
}
{
"result": "ERR",
"message": "Error message ..."
}