The list-pull command is used to retrieve a list of pull requests.
JSON Input Data Format
{
"id": string
}
id*
Specifies the ID of the repository.
* 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": "V7dcf7bce3-xxxx-xxxx-xxxx-7e49xxxxx1148"
};
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": "V7dcf7bce3-xxxx-xxxx-xxxx-7e49xxxxx1148"
};
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": "V7dcf7bce3-xxxx-xxxx-xxxx-7e49xxxxx1148"
}
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": "V7dcf7bce3-xxxx-xxxx-xxxx-7e49xxxxx1148"
}.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