REST request to query Google datastore - google-app-engine

Is there a way to make a POST request to query google datastore and get back results? I know there's a way to do this with BigQuery, but I'm unable to find a way to query DS.
Google API docs mention the runQuery request but that doesn't come back with the results.
https://cloud.google.com/datastore/docs/reference/rest/v1/projects/runQuery#QueryResultBatch
To be more specific, I get the response below when I call runQuery:
Request body to runQuery
{
"gqlQuery": {
"allowLiterals": true,
"queryString": "SELECT * from Products where name > 'App' "
}
}
Response body
"batch": {
"moreResults": "NO_MORE_RESULTS",
"endCursor": "CgA=",
"entityResultType": "FULL"
}
My expectation was that the batch object should have the results.
Would appreciate any help!
Thanks,
Sammy

Related

Firebase GET request orderby 400 bad request

For a get request, I am trying to user order by like below but always get a 400 bad request. Here, multiple users can have multiple blog posts each with a unique id like b1 in screenshot below. The long sequence of characters is the uid of a user under blogs. Each user has their own uid.
https://assignment-c3557-default-rtdb.asia-southeast1.firebasedatabase.app/blogs.json?orderBy="createdAt"
I followed the documentation here
https://firebase.google.com/docs/database/rest/retrieve-data
All I am doing is issuing a simple GET request in react js as follows:
const resp = await fetch(`https://assignment-c3557-default-rtdb.asia-southeast1.firebasedatabase.app/blogs.json?orderBy="createdAt"``)
const data = await resp.json()
if(!resp.ok) { ... }
Below is the database single entry for schema reference
As I said in my previous comment, this URL is invalid:
https://assignment-c3557-default-rtdb.asia-southeast1.firebasedatabase.app/blogs.json/orderBy="createdAt"
                                                                                     ^
The query portion of a URL starts with a ? character.
https://assignment-c3557-default-rtdb.asia-southeast1.firebasedatabase.app/blogs.json?orderBy="createdAt"
                                                                                     ^
Firebase Realtime Database - Adding query to Axios GET request?
I followed the above similar issue resolution to solve my problem

Selling Partner API Feeds API

I am using the Feeds API to update inventory using the this link. I am able to perform the Step 1 :- Create a feed document response is
{
"payload":{"encryptionDetails":
{
"standard":"AES","initializationVector":"vHLW3sNN41sEQp1e9wjNSg==",
"key":"oQvgdrwiBbBO3SLf4p81zQuIgROkTDA9Yikv6DvMIcg="
},
"feedDocumentId":"amzn1.tortuga.3.11ef10ee-e839-4a0b-b7a4-dcfbe78900ae.T1OWK0QMT4NDF7",
"url":"https://tortuga-prod-eu.s3-eu-west-1.amazonaws.com/%2FNinetyDays/amzn1.tortuga.3.11ef10ee-e839-4a0b-b7a4-dcfbe78900ae.T1OWK0QMT4NDF7?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20210117T190852Z&X-Amz-SignedHeaders=&X-Amz-Expires=300&X-Amz-Credential=&X-Amz-Signature="
}
}
At Step 2 Encrypt and upload the feed data Response :-
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your key and signing method.XXXXXXXXXXXXXXXXXXXXAWS4-HMAC-SHA256 20210117T190852Z 20210117/eu-west-1/s3/aws4_request 6efdf3105b88a49723fed6068792a6f1a5858196f957e3a52f76e4cee2ccb07e9197ea9212ce444f640080a3df1d628de0bc26d9a0cafea9577fd23d2c1b3fc6 BYTESPUT //NinetyDays/amzn1.tortuga.3.11ef10ee-e839-4a0b-b7a4-dcfbe78900ae.T1OWK0QMT4NDF7 X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=CREDENTIAL&X-Amz-Date=20210117T190852Z&X-Amz-Expires=300&X-Amz-SignedHeaders=content-type%3Bhost content-type:application/json host:tortuga-prod-eu.s3-eu-west-1.amazonaws.com content-type;host UNSIGNED-PAYLOADBYTESEA417EC74F012746CpSqzu64eIWZv0Y7JWoylN5rrCAJzort9+7EGhH0KqaSHknlV+ZYuX76zqv2shr+yFDksDntFNI=
Anybody facing the same problem or any ideas where the problem is

query data in a airtable database using url

I want to implement URL for search specific data in my base using filterByFormula
below are my link and I got an error and how to resolve that
my url:
api.airtable.com/v0/APPID/Stories?filterByFormula=(FIND(“Car (in robot form) will offer a hug when I am stressed out”,{User want}) &api_key=MYKEY
Error :
{
"error": {
"type": "INVALID_FILTER_BY_FORMULA",
"message": "The formula for filtering records is invalid: Invalid formula. Please check your formula text."
}
}
I tried using postman, please help me.
While querying filtered data from Airtable via API, you don't have to use FIND keyword. You can filter data with simple Airtable formula like structure. For example,
{Email} = 'johnwick#neverdie.com'
Above filter retrieve all the records from the table whose Email is simply johnwick#neverdie.com
To limit number of records retrieve by API maxRecord parameter is available for that. For more info about various parameters please refer my answer here AirTable API Find record by email or official Airtable API Documentation
In your case
API url would be structured like,
api.airtable.com/v0/APPID/Stories?filterByFormula=Car+(in+robot+form)+will+offer+a+hug+when+I+am+stressed+out%3D%22User+want%22&api_key=MYKEY
For more info about Airtable API encoding, check this https://codepen.io/airtable/full/rLKkYB?baseId=app1C5TVoophmmr8M&tableId=tblvILr4aSAYI98oa
Hope this helps!

Getting error while calling Salesforce Einstein Analytics REST API SAQL query

I am trying to Fetch the dataset from Einstein Analytics through Analytics REST API SAQL Query Resource. I have followed the document given at https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_rest.meta/bi_dev_guide_rest/bi_resources_query.htm.
However, when I am calling the Salesforce Einstein Analytics through REST API from PostMan, I am getting below Response:
[
{
"errorCode": "118",
"message": "Expected query or query name in body."
}
]
The URL in the Postman POST request is
https://ap4.salesforce.com/services/data/v42.0/wave/query
My Request body contains:
{
"query":"q = load \"0Fb6F0000004eD4SAI/0Fc6F000001t5hWSAQ\";q = foreach q generate 'Account_Owner' as 'Account_Owner', 'Account_Type' as 'Account_Type', 'Amount' as 'Amount', 'Billing_State_Province' as 'Billing_State_Province', 'Close_Date_day_epoch' as 'Close_Date_day_epoch', 'Close_Date_sec_epoch' as 'Close_Date_sec_epoch', 'Column1' as 'Column1', 'Created_Date_day_epoch' as 'Created_Date_day_epoch', 'Opportunity_Name' as 'Opportunity_Name', 'Product_Name' as 'Product_Name';q = foreach q generate 'FirstName' as 'FirstName', count() as 'count';q = limit q 2000;"
}
Here while calling REST API I have made proper use of oAuth2.0 token.
Please let me know - what could be the problem in my Request, is the format of my request is correct.
Looks like you forgot the " at the very end right after the semicolon...
...
q = limit q 100;" <-
I have got the solution to it, I had not set the content-type of my request as application/json.
After setting it as a parameter in the header of the request in Postman, I am able to get the proper response.

How to fetch Adwords campaign data from Google Analytics API?

Hi i am using Google Analytics API and interested in extracting the AdWords Campaigning data which is available under OverAll Traffic>>Acquisition>>Adwords>>Campaigns and my query for the same is
return service.data().ga().get(
ids='ga:' + profile_id,
start_date=start_date,
end_date=end_date,
metrics='ga:CPC,ga:transactions,ga:transactionsPerSession,ga:adCost,
ga:transactionRevenue,ga:bounceRate,ga:impressions,ga:adClicks,
ga:sessions',dimensions='ga:campaign,ga:deviceCategory',
sort ='-ga:adClicks',
segment = 'gaid::-1').execute()
but the above query is giving me the data related to all the campaigns but i only want to fetch the data that is related to Adwords Campaigns only.So, please help me in getting this done. I guess there should be some filter or any thing else by which we can extract the desired data.
ga:sourceMedium==google / cpc
Use the above filter in your API request.
Or
Pull dimension ga:sourceMedium and then filter google / cpc from the result set.
auth: jwt,
ids: "ga:" + view_id,
"start-date": "YYYY-MM-DD",
"end-date": "YYYY-MM-DD",
metrics: "ga:adCost",
dimensions: "ga:campaign",
"start-index": "1",
"max-results": "1000"
You can do something like this

Resources