I want start app's build using Openshift Rest API https://docs.openshift.com/container-platform/3.7/rest_api/index.html.
What I need:
change source ref (branch) for build
start new build from new branch
without using triggers build or oc tool.
I cann't find how to do that in https://docs.openshift.com/container-platform/3.7/rest_api/apis-build.openshift.io/v1.Build.html
It can be done using OC Tool Analogue:
oc start-build name -n namespase
But I want do this using REST API
Thank you very much!
curl -H "Authorization: Bearer xxx" -H 'Accept: application/json' -XPOST "$openshiftUrl/apis/build.openshift.io/v1/namespaces/YOURNAMESPACE/buildconfigs/CONFIGNAME/instantiatebinary?name=XXXX&namespace=YOURNAMESSPACE" --data-binary #/tmp/eQXEUXr.zip
using axios
return axios({
method: 'post',
url: 'url/apis/build.openshift.io/v1/namespaces/YYY/buildconfigs/XXX/instantiatebinary?name=XXX&namespace=YYY',
data: fs.createReadStream('/tmp/eQXEUXr.zip'),
headers: {
'content-type': `application/octet-stream`,
'Authorization': 'Bearer aaaaaa',
'Accept': 'application/json'
},
maxContentLength: Infinity,
maxBodyLength: Infinity,
httpsAgent: new Agent({
rejectUnauthorized: false
}),
timeout: 300000,
}
Related
The API is : /repos/{owner}/{repo}/pulls.
I used the correct token, and the request body is :
data = {
"base": "master",
"head": "owner:master",
"title": "title",
}
The head is like this:
{'Accept': 'application/vnd.github.v3+json', "Authorization": "token {}".format(git_token)}
Then I call the pull API. Returned 200.
<Response [200]>
Why? Maybe the request body wrong?
The Pull Request API specified the answer:
Status: 201 Created
Try and anddapt their example to your repository, to see if it does work:
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/pulls \
-d '{"head":"head","base":"base"}'
It's sad to see no concrete examples are available when it comes to using OAuth2 package of Flutter.
I'm a beginner, the example mentioned here is tough for me to crack(I learn mostly through videos), but my job requires me to implement OAuth by today itself. So I'm trying my shot here.
This is what I've:
Login API
curl --location --request POST 'https://domain/api/rest/oauth/token' \
--header 'Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=<username_here>' \
--data-urlencode 'password=<md5_of_password_here'
I've been given a sample username and password as well..
This is what I've implemented so far..
void checkAuthentication() async {
String username = 'username';
String password = 'password';
String basicAuth =
'Basic ' + base64Encode(utf8.encode('$username:$password'));
print(basicAuth);
var body = jsonEncode(
<String, dynamic>{
'grant_type': 'password',
'username': 'username',
'password': 'password',
},
);
Response r = await http.post(
Uri.https('domain', 'api/rest/oauth/token'),
headers: <String, String>{
'authorization': basicAuth,
'Content-Type': 'application/x-www-form-urlencoded',
'accept': 'application/json',
},
body: body,
);
print(r.statusCode);
print(r.headers);
print(r.body);
}
I'm getting 301 as result..
What can I do to get 200. Please guide me.
I'm attempting to use Google Apps Script to access Salesforce's Bulk API 2.0 and upload the CSV data to a job, however Salesfore is returning
[{"errorCode":"METHOD_NOT_ALLOWED","message":"HTTP Method 'GET' not allowed. Allowed are PUT"}]
Given my experience with the Salesforce API, I highly doubt the issue is actually with the method type, but that there is some other validation which is causing this error. However, upon inspection of the request body and comparing it to what I successfully submit through cURL, I don't see what I can do to resolve.
The request code:
var headers = {
"Authorization": "Bearer TOKEN"
};
var options = {
"method": "put",
"contentType": "text/csv",
"headers": headers,
"payload": "Id,Entity_Name__c\n001,One\n002,Two\n003,Three"
};
var url = INSTANCE + "/services/data/v44.0/jobs/ingest/" + JOB_ID + "/batches";
UrlFetchApp.fetch(url, options);
Google Apps Script request as returned via getRequest():
{
"headers": {
"Authorization": "Bearer TOKEN"
},
"method": "put",
"payload": "Id,Entity_Name__c\n001,One\n002,Two\n003,Three",
"followRedirects": true,
"validateHttpsCertificates": true,
"useIntranet": false,
"contentType": "text/csv",
"url": "INSTANCE/services/data/v44.0/jobs/ingest/JOB_ID/batches"
}
cURL request:
curl --request PUT \
--url INSTANCE/services/data/v44.0/jobs/ingest/JOB_ID/batches \
--header 'authorization: Bearer TOKEN' \
--header 'content-type: text/csv' \
--data '"Id,Entity_Name__c\n001,One\n002,Two\n003,Three"'
How can I resolve this?
I'm trying to make a HTTP request to modify password from users that are stored into WSO2. I'm using the following request:
{
method: 'PUT',
url: domain + '/wso2/scim/Users/' + userId,
rejectUnauthorized: false,
headers: {
Authorization: 'Bearer ' + scimToken,
'Content-Type': 'application/json'
},
json: true,
body: {
userName : 'foo',
password : 'newPassw0rd'
}
}
But response returns a Java exception (I don't attach it here, because is too long and I think that doesn't have sense. Is related with Apache CXF).
I'm so new with SCIM and WSO2, so I think that I'm making a mistake in the request. Does anyone knows what's wrong?
Thanks!
create user with this request:
curl -v -k --user admin:admin --data '{"schemas":[],"name":{"familyName":"gunasinghe","givenName":"hasinitg"},"userName":"hasinitg","password":"hasinitg","emails":[{"primary":true,"value":"hasini_home.com","type":"home"},{"value":"hasini_work.com","type":"work"}]}' --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
update password
curl -v -k --user admin:admin -X PUT -d '{"schemas":[],"name":{"familyName":"gunasinghe","givenName":"hasinitg"},"userName":"hasinitg", "password":"pwd123","emails":[{"value":"hasini#wso2.com","type":"work"},{"value":"hasi7786#gmail.com","type":"home"}]}' --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users/0032fd29-55a9-4fb9-be82-b1c97c073f02
I have successfully completed the first three steps of the authentication process: step one(authorize), step two (receive redirect ) and step three (get an access token).
But, doing the following request gives me an error:
curl -H 'Authorization: Bearer xxxxoKnAKxxxxxndQNRZgRa0Dxxxxx' 'https://sandbox-api.uber.com/v1/requests'
Response:
{"message":"Not supported","code":"not_found"}
I have the same message with all required params:
curl -H 'Authorization: Bearer xxxxoKnAKxxxxxndQNRZgRa0Dxxxxx' 'https://sandbox-api.uber.com/v1/requests?product_id=5b451799-a7c3-480e-8720-891f2b51abb4&start_latitude=48.869576&start_longitude=2.30825&end_latitude=48.84839&end_longitude=2.395921'
Am I missing something?
Edit:
Ruby version with HTTParty:
def request(bearer, product_id="5b451799-a7c3-480e-8720-891f2b51abb4", start_latitude=48.869576, start_longitude=2.30825, end_latitude=48.84839, end_longitude=2.395921)
parameters = { product_id: product_id,
start_latitude: start_latitude,
start_longitude: start_longitude,
end_latitude: end_latitude,
end_longitude: end_longitude
}
self.class.post('/v1/requests', query: parameters, headers: { "Authorization" => "Bearer #{bearer}", 'Content-Type' => 'application/json' })
end
A GET to 'https://sandbox-api.uber.com/v1/requests' won't work since you need to include a such as https://sandbox-api.uber.com/v1/requests/request_id
A POST to 'https://sandbox-api.uber.com/v1/requests' requires you to post the parameters as part of the JSON body.
Once you have the request ID as part of the response, you will able poll for details using the first command.