These are my temporary API settings:
wallet:accounts:read wallet:addresses:read wallet:buys:read wallet:checkouts:read wallet:contacts:read wallet:deposits:read wallet:notifications:read wallet:orders:read wallet:payment-methods:read wallet:sells:read wallet:transactions:read wallet:transactions:request wallet:transactions:send wallet:transactions:transfer wallet:user:read wallet:withdrawals:read
Reading account data:
HTTP REQUEST
GET https://api.coinbase.com/v2/accounts
SCOPES
wallet:accounts:read
... works well.
But the request of transactions data (I only need the buys as shown in the picture)...
Coinbase Dashboard Picture
Coinbase API Transactions
HTTP REQUEST
GET https://api.coinbase.com/v2/accounts/:account_id/transactions
SCOPES
wallet:transactions:read
... gives me an empty result:
{"pagination":{"ending_before":null,"starting_after":null,"limit":25,"order":"desc","previous_uri":null,"next_uri":null},"data":[]}
Anyone an idea what I could miss here?
I have no idea why you cannot get transactions. Let me tell; I've transactions on my BTC account. Retrieved and Sold BTC. When I call
https://api.coinbase.com/v2/accounts/account_id/transactions
with a CB-VERSION of 2018-05-09 (which is newly released), it returns.
Be sure about;
1- You have transactions in your selected account. When you check from coinbase.com, be sure you are seeing transactions.
2- Be sure your account id is going to API with URL
3- Be sure selected account id is matches with sending account id.
3- Be sure your request headers are ok.
4- Be sure your Auth token is not expired.
I'm pretty sure that you're missing somethings in your code. If none of them above don't solve your problem, find me. I can assist.
Thanks for your answer - I got it.
My fault was to think I need to request my transactions for one and only account id, something like user id. But after reading the account JSON a little bit more accurate I found out that there is an account id for every wallet. I read out the EUR wallet where I have of course no single transaction.
Thanks anyway.
Sebastian.
Related
I'm working with the pipedrive API and trying to update a record (deal, but the endpoint isn't important). The format of the is as follows.
https://companyDomain.pipedrive.com/api/v1/deals/DealID?api_token=API-Token
Where companydomain specifies your account with them, dealID is the ID we're updating and API token is the token supplied by pipedrive to access the API. It's not a token that's returned by logging in, it's static one, given on day one and never changes.
HttpClient seems to want a base address so "https://companyDomain.pipedrive.com/", then something like the following:
HttpResponseMessage response = await client.PutAsJsonAsync(
$"api/v1/deals/{dealId}/", args);
Where args is a class with the field/s and value/s I want to update.
If I include the api_token as fields in "args", it returns a 404 not found. If I append it to the base url or the $api/v1/deals/{dealID}/ it returns permission denied.
Any suggestions as to how I can handle this?
I've managed to make a living coding for 30 years avoiding the web, now it's all anyone seems to want. Appears I have to finally get a handle on this, hence the recent questions! ;-)
Thanks in advance
Jim
Append it with a "?"
So your URL should look like api/v1/deals/YOUR_ID?api_token=THE_TOKEN
HttpResponseMessage response = await client.PutAsJsonAsync(
$"api/v1/deals/{dealId}?api_token={apiToken}", args);
We have our master Stripe account, and custom / connected accounts which we eventually want to transfer funds to, and then payout to their external bank accounts.
I have some code that works without issue in test mode, but on production we get an exception when doing the payout step. The error details are:
Stripe.StripeException: Cannot create payouts with an OAuth key.
at Stripe.Infrastructure.Requestor.ExecuteRequest(HttpRequestMessage requestMessage)
at Stripe.Infrastructure.Requestor.PostString(String url, StripeRequestOptions requestOptions)
As far as I know, we are not using an OAuth key for this request, as I set up the StripeAPI with the secret key in Startup.cs of our MVC web application:
StripeConfiguration.SetApiKey("sk_live_**************");
And the actual code to attempt the payout:
StripePayoutService sps = new StripePayoutService();
StripeRequestOptions connectRequest = new StripeRequestOptions();
connectRequest.StripeConnectAccountId = stripeConnectID; //"acct_*********"
StripePayoutCreateOptions spco = new StripePayoutCreateOptions();
spco.Amount = (int)(amount * 100);
spco.Currency = "GBP";
spco.StatementDescriptor = reference;
StripePayout result = sps.Create(spco, connectRequest);
I've specified the connected account id on the stripe request options and the Api Key in initialization, so what is causing the request to complain about OAuth credentials, or what am I missing / doing wrong in this scenario?
It turns out due to an edge case, as the wrong Stripe key was being used, so the OAuth key error message was a red herring. I would recommend anyone investigating an issue similar to this to check:
the request details (via the request id) in the api/logs section on the stripe dashboard, and that a request exists against the appropriate Stripe account
there are enough funds / the transfer succeeded, prior to the payout being requested
You are not doing anything wrong here. Its completely correct just available amount for payout is not available in test data of connect account. Do a test transaction and add amount to stripe test account. It should work fine.
I want to know how can I use GMB API to fetch reviews. According to google documentation we have to make a GET request to https://mybusiness.googleapis.com/v3/{name=accounts/*/locations/*}/reviews
But what is meant by {name=accounts/*/locations/*} and from where we can get the value of accounts & locations.
Also this requires OAuth 2.0. If I get a access_token then GET request will be like this:-
https://mybusiness.googleapis.com/v3/{name=accounts/*/locations/*}/reviews?access_token=token
This is very confusing. Can somebody tell me how to use GMB API correctly to fetch google reviews.
Using Google OAuth 2 Playground
For testing acquisition of Google reviews
Create a project
Console.cloud.google.com
Sign in as {projectowner}#google.com
Select a project from the dropdown in the header or click new project
Go to APIs & Services in the left menu
Enable the Google My Business API; this requires validation by Google and may take a couple of days. They will email you.
Go to developers.google.com/oauthplayground
Using the settings gear, set OAuth flow to Client-side and click Use your own OAuth credentials
Get the client id from console.developers.google.com/apis and paste it in
Put this into scope: https://www.googleapis.com/auth/plus.business.manage and authorize it with {projectowner}#gmail.com
Exchange auth code for token
To get the account name:
Set Request URI to https://mybusiness.googleapis.com/v4/accounts and send a Get request
Copy the entire string value at “name”: not including quotes; it may be 20+ numeric digits
To get location names:
Set Request URI to https://mybusiness.googleapis.com/v4/accounts/{paste account name here}/locations where {paste ... here} is the account name you copied
The returned JSON contains all of your locations
Copy the location names including quotes and commas to a temporary holding document; they will be used in a JSON array in the next step
To get multiple locations’ reviews
a. Set Request URI to https://mybusiness.googleapis.com/v4/accounts/{account name here}/locations:batchGetReviews and the Method to Post
b. Set Request Body to
{
"locationNames": [
"accounts/999999999999999999999/locations/88888888888888888888",
"accounts/999999999999999999999/locations/77777777777777777777",
.
.
.
"accounts/999999999999999999999/locations/11111111111111111111"
],
"pageSize": 200,
"orderBy": "updateTime desc",
"ignoreRatingOnlyReviews": false
}
using the account names you saved from the location JSON for each line of the array
If you have more than 200 total reviews you will have to add "pageToken": string into the JSON body where string is a value returned in the preceding POST.
But what is meant by {name=accounts//locations/} and from where we can get the value of accounts & locations.
To get this details first get the account using the following API (https://mybusiness.googleapis.com/v4/accounts?access_token=#####)
Once you have the account list, fetch Account Location list using the following API (https://mybusiness.googleapis.com/v3/" + name + "/locations) in the response of this API you will get the {name=accounts/*/locations/*}.
Also this requires OAuth 2.0. If I get a access_token then GET request will be like this: https://mybusiness.googleapis.com/v3/{name=accounts/*/locations/*}/reviews?access_token=token
Yes, that is correct.
Let me know if this work's for you.
I have been integrating QuickBooks's API to my web application. I made requests to get tokens (both request token and secret token), I stored them to database. So, how can I validate connection at second time or more, I mean because I had tokens in database, so I don't want to re-authorize to get other new tokens. I tried to find solutions to resolve it, but there's no anything. Please give me some methods or advices to get it done. Thank you very much!
So, how can I validate connection at second time or more,
You can validate tokens by doing a query against a v3 service, and checking to see if you get a 200 OK or a 401 Unauthorized response back.
Pseudo-code should look something like this:
function am_i_connected_to_quickbooks()
{
if (you have tokens stored in your database)
{
results = do_qb_query("SELECT * FROM Customer MAXRESULTS 1")
if (you got a 200 OK back from Intuit)
{
// You are connected, and the tokens are still valid/have not been revoked
return true
}
}
// You don't have tokens, or your tokens are invalid (revoked, expired, incorrect, etc.)
return false
}
I'm developing a feature for our product that will allow users to send SMS messages via Twilio and we handle all of the account issues. We have our Master Account and all of our customers will be sub accounts under us.
In an effort to not have to keep track of 1000+ auth tokens, we decided to use our Master Account credentials to send the SMS message however we still want it to roll up under the sub account. According to Twilio, this shouldn't be an issue.
My problem is that there is very little (that I've found) documentation for the c# library they provide. I'm not sure if what I've done is the correct way to accomplish what I described above and since I'm on a trial account until the project is finished and can be rolled out to production I have no way of testing.
var twilio = new TwilioRestClient("Master SID", "Master Auth Token");
var response = twilio.SendSmsMessage(sender, recipient.ConvertToE164Format(), message, null, "Subaccount SID");
The comment on this overload isn't really clear on if passing the subaccounts SID here will send the message as if I had logged into their account and sent it.
// applicationSid:
// Twilio will POST SmsSid as well as SmsStatus=sent or SmsStatus=failed to
// the URL in the SmsStatusCallback property of this Application. If the StatusCallback
// parameter above is also passed, the Application's SmsStatusCallback parameter
// will take precedence.
The callback url will be the same across all accounts so I don't need/care about that value.
Short Version:
If I log in with my Master Account details but pass the subaccount SID in the SendSmsMessage() method, which account does the message come from?
Twilio support finally got back to me and confirmed my fears that this wouldn't work. I do have to pull the subaccount information down and reinstantiate the twilioRestClient with the new credentials which I was hoping I could get away with not doing. Just a few extra lines.
var twilio = new TwilioRestClient("Master SID", "Master Auth Token");
var subAccount = twilio.GetAccount("SubAccount SID");
var subAccountClient = new TwilioRestClient(subAccount.Sid, subAccount.AuthToken);
var response = subAccountClient.SendSmsMessage(sender, recipient.ConvertToE164Format(), message);
return response.Sid;