I'm trying hard to find the latest way to settle a payment in escrow and the docs seem to be outdated.
The rave v2 docs clearly show that the endpoint https://api.ravepay.co/v2/gpx/transactions/escrow/settle should settle a pending escrow payment, however, a 404 error comes up instead.
I've tried using https://rave.flutterwave.com and https://ravesandbox.flutterwave.com
No docs I can find show the right API endpoint to settle escrow payment.
Note: there's an older answer on this platform but it no longer works.
Flutterwave docs dont do a good job telling that this is a POST method, not GET.
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
};
let data = {
"id": txid,
"secret_key": "your-secret-key"
};
fetch('https://api.ravepay.co/v2/gpx/transactions/escrow/settle', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err))
Related
Need assistance, I have gotten it right to have the POST API show the responses as it should.
I need assistance with getting these responses shown on the product pages on Shopify, as they are product qty's from the supplier. I am new at this so please be easy on me...
Running the API in VisualCode with Thunder Client.
Have the following JS running but dont know if i am on the right path, it is then linked to an html to actually show the results.
fetch("URL")
.then((response) => {
if (response.ok) {
return response.json();
} else {
throw new Error("NETWORK RESPONSE ERROR");
}
})
.then(data => {
console.log(data);
display(data)
})
.catch((error) => {
return console.error("FETCH ERROR:", error);
});
const token = localStorage.getItem('token')
const response = await fetch(apiURL, {
method: 'POST',
headers: {
'Content-type': 'application/json',
'Authorization': `Bearer ${ttoken}`,
}
})
How to remove issue from sprint by rest api ?
I only find the api to move issue to sprint in this docs
https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/sprint
Not found api to remove issue from sprint
I search with google, get this way http://jira:8080/rest/JIRA Agile/1.0/sprint/1/issues/remove by pust,but It does'nt work!
https://confluence.atlassian.com/jirakb/how-to-add-and-remove-issue-to-from-sprint-via-rest-api-779158574.html
I send the put request by postman to this url
http://10.22.0.170:8080/rest/agile/1.0/sprint/497/issues/remove
It return 404 say uri not found
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status>
<status-code>404</status-code>
<message>null for uri: http://10.22.0.170:8080/rest/agile/1.0/sprint/497/issues/remove</message>
</status>
I want to remove issue from sprint by agile rest api
This is what you're looking for: https://docs.atlassian.com/jira-software/REST/7.0.4/#agile/1.0/backlog-moveIssuesToBacklog
Move issues to the backlog. This operation is equivalent to remove
future and active sprints from a given set of issues. At most 50
issues may be moved at once.
Node.js example
const fetch = require('node-fetch');
headers = {
'Authorization': `Basic ${Buffer.from(
'username:jira_api_token'
).toString('base64')}`,
'Accept': 'application/json',
'Content-Type': 'application/json'
}
const bodyData = `{
"issues": [
"YOURISSUE-810"
]
}`
fetch('https://your-domain.atlassian.net/rest/agile/1.0/backlog/issue', {
method: 'POST',
headers: headers,
body: bodyData
})
.then(response => {
console.log(
`Response: ${response.status} ${response.statusText}`
);
return response.text();
})
.then(text => console.log(text))
.catch(err => console.error(err));
I always get correct response from this request in my browser console:
fetch('http://178.62.66.29:8080/api/v1/auth/1/2', {
method: "GET",
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
.then(response => response.json())
.then(responsejson => console.log(responsejson))
.catch(err => console.error(err));
But when I use the exact same code in React native (Android) the fetch function doesn't resolve or reject anything. The thing is, sometimes the fetch function works (Like 1/10) which makes this problem even more confusing to me.
I am trying to learn react native application by making a simple login page using api call. Where I will send user name and password to api and it will give me response. But I can't do it. Well I am sharing my code here.....
var myRequest = new Request('<my API >', {method: 'POST', body: '{"username":this.state.uName , "password":this.state.pwd}'});
fetch(myRequest).then(function(response) {
alert('Res'+response);
}).then(function(response) {
alert('Blank'+response);
})
.catch(function(error) {
alert('Error'+error);
});
I think the way of passing my user name and password to server is wrong. Please give me some idea then I can understand what is wrong here.
var data = {
"username": this.state.username,
"password": this.state.password
}
fetch("https://....", {
method: "POST",
headers: headers,
body: JSON.stringify(data)
})
.then(function(response){
return response.json();
})
.then(function(data){
console.log(data)
});
I hope this helps.
You need to Stringify the json data to send request as Post method with Json parameters as you are trying to do...
Here is the example code for how to encode data before requesting for response
fetch('https://mywebsite.com/endpoint/', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
firstParam: 'yourValue',
secondParam: 'yourOtherValue',
})
})
Here is the sample code for login :
fetch(<hostURL>, {
method: 'POST',
headers: { 'Accept': 'application/json','Content-Type': 'application/json',},
body: JSON.stringify({ userName: <userName> ,Password: <Password>,})
}).then((response) => response.json())
.then((responseData) => {
console.log(responseData);
}).catch((error) => {
console.log("Error");
});
As the commentators before me stated, you simply need to stringify your JSON Body. In general, I' suggest that you incorporate e.g. api sauce into you stack. It is a comprehensive wrapper around the axios library, providing standardized errors and an ok key for quick checks.
I am making Log In page for my react native application. My api sends different response when my username and password are valid and invalid. So I want to track and save the status of my response in some state variable and then later perform function accordingly. Please suggest me way to do that.
doSignUp() {
console.log("inside post api");
fetch('MyApiUrl', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
password: this.state.password,
email:this.state.email,
name: this.state.firstname,
last_name :this.state.last_name,
mobile:this.state.mobile,
ssn:"2222222"
})
}).then((response) => {console.log('response:',response.status);
response.json()}
.then((responseData) => {
console.log("inside responsejson");
console.log('response object:',responseData)
console.log('refresh token:',responseData[0].token.refresh_token)
console.log('access token:',responseData[0].token.access_token);
}).done();
}
As far as I understand you want to know the http status code of your fetch request.
Usually your response object includes a "status" property. So you should be able to receive the status code by using this:
response.status
In case of a successful request this will return 200.