Can we add multiple labelId in history.list API for gmail? - api

I want to get the result of all INBOX mails and all SENT mails in one API call using the historyID and the history.list Gmail-API.
Refer:
https://developers.google.com/gmail/api/v1/reference/users/history/list
When I am hitting the following GET request :
https://www.googleapis.com/gmail/v1/users/{userID}/history?startHistoryId={historyID}&labelId=SENT&labelId=INBOX
I only get the SENT label messages.
Seems like the API only accepts single & first query param for labelId.
Is there a way to get multiple labelIds' response in a single API call?

I think it would not be possible, I tried making a multiple request and it this response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Invalid label value in query"
}
],
"code": 400,
"message": "Invalid label value in query"
}
}
I would suggest to call it separately for each labelID but you can try filing a feature request for this.
Hope this helps.

Related

Twitter API v2 - Making a loop that collect an ID from a response, and insert on the next request

I'm having trouble looping a group of requests on the "Full Archive Search" on Twitter API v2.
I need to get all the responses from a determined subject, but there is a limit of tweets per page. To cover this, a "next_token" is generated on the body response. I need to make lots of requests using the "next_token" as a parameter to the subsequent request.
The thing is, I have no idea how can i make a loop, and collect all the responses.
There are more than 500.000 tweets in the period that I am searching for. And the limit of tweets per page is 500.
I'm using the default request from the "Full Archive Search", on Twitter API, using "query", "start_time" and "end_time"
The response that I got has a limit of tweets per page. At the bottom of each page, have the following lines:
"meta": {
"newest_id": "1321965025809059840",
"oldest_id": "1321964960956768256",
"result_count": 8,
**"next_token": "b26v89c19zqg8o3fosbski4ttnan7ven9iyr8gbrdfiwt"**}
I need to get that "next_token" and add it to the subsequent request.
Does anyone have an idea how can i collect all this data?
Edit: I tried to use the code below to get the "next_token":
pm.test("Set Next Token", function () {
var jsonData = pm.response.json();
console.log(jsonData.next_token)
pm.collectionVariables.set("next_token", jsonData.next_token);
});
But it returns to this error:
{
"errors": [
{
"parameters": {
"next_token": [
"null"
]
},
"message": "Invalid 'next_token':'null'."
}
],
"title": "Invalid Request",
"detail": "One or more parameters to your request was invalid.",
"type": "https://api.twitter.com/2/problems/invalid-request"
}

Strapi API register returning a 400 error

I’ve been creating a web app with a login and a registration function and so far everything has been going great. I managed to connect the app to the api/auth/local api endpoint and send some nice post requests.
Now, I’ve been trying to send requests to the http://localhost:1337/api/auth/local/register endpoint and without any success. I’ve been doing this according to:
https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#registration
I keep getting a 400 error:
{
"data": null,
"error": {
"status": 400,
"name": "ApplicationError",
"message": "An error occurred during account creation",
"details": {
}
}
}
If I try to send a request with an email that’s already registered in strapi, the response will give me the correct error:
{
"data": null,
"error": {
"status": 400,
"name": "ApplicationError",
"message": "Email is already taken",
"details": {
}
}
}
In the public and authenticated user roles, I’ve allowed every single one of them, for now.
Enable confirmation emails are set to false.
Email confirmation
Public user permission
For the headers, I’m using Content-type : application/json
the raw json body I'm posting:
{
"email": "manager1#strapi.io",
"password": "testtest1",
"username": "manager1"
}
This is my first project with strapi and so far it went pretty well. I’m not sure if I’m missing out on something or if I’m doing something else wrong.
Any help is appreciated!
I figured it out, it wasn’t as complicated as I expected.
In the user I had different fields, like firstName, lastName etc. All of these fields were required.
I made the fields not required, and now it works.

Walmart API Error: WM_CONSUMER.CHANNEL.TYPE set null or invalid

My client has a Walmart marketplace store and we are trying figure out how to successfully make the Walmart API's Multiple Item Inventory for All Ship Nodes API call.
The API production URL is :
https://marketplace.walmartapis.com/v3/inventories
The purpose of this call is getting the inventory of the store using the API.
Unfortunately, we are stuck because we don't know what value to put for WM_CONSUMER.CHANNEL.TYPE.
As a result, the API response is unsuccessful and gives this error:
{
"error": [
{
"code": "INVALID_REQUEST_HEADER.GMP_GATEWAY_API",
"field": "WM_CONSUMER.CHANNEL.TYPE",
"description": "WM_CONSUMER.CHANNEL.TYPE set null or invalid",
"info": "One or more request headers are invalid.",
"severity": "ERROR",
"category": "DATA",
"causes": [],
"errorIdentifiers": {}
}
]
}
Where can the value of WM_CONSUMER.CHANNEL.TYPE be found?
I had the same exact issue. I had to open a ticket with support to get the WM_CONSUMER.CHANNEL.TYPE.
Just an FYI, this didn't solve the problem as the value they gave us still resulted in the API returning the same error code.

Google Search API Missing Parameter q

Not sure what I'm doing wrong here. I have been following these instructions fully.
Anyways, I am trying to use Google custom search API. I have my API and CS key. I enter the following, with appropriate info filled in, but it says I am missing the q parameter when I am clearly not. Any ideas what I am doing wrong?
curl https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter: q",
"locationType": "parameter",
"location": "q"
}
],
"code": 400,
"message": "Required parameter: q"
}
}
The colon in the cx parameter must be URL encoded., i.e. 017576662512468239146%3Aomuauf_lfve. Using jQuery $.get with a params object will do this for you if you like.
The Google API states that "q" or the query is necessary to run.
Parameter name Value Description
Required query parameters
cx string The custom search engine ID to use for this request.
q string Query
https://developers.google.com/custom-search/v1/cse/list

Fusion table API, INSERT query, bad request

I have a fusion table with fields: username, description,latitude,longitud,geolocation. I am trying to create a new row with information via the google API. I triple checked that the fusion table is open, the tableid and the apikey are correct, and I have the fusiontable API enabled with 0% of the quota. I think the wrong request must be because some coma or quotation mark but to be honest it completely escapes me. I have tried different combinations and cannot find the mistake. Below error that I get, the code that use in php to generate the link and the link itself. Any idea would be greatly appreciated.
Thank you
link returns:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "keyInvalid",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
Php Code:
$apikey = "AIzaSyB4BMlrZIlJB-Apo8t_dO9K18uL8O2s5TA";
$tableid = "1X0rFoG7Tt2Ocm2rE39wPuamZCrFiS4D32Odgbh03";
$username="webuser";
$description="nujkn";
$latitude="78";
$longitud="110";
$geolocation="98.8789, 150.1111";
$link = "https://www.googleapis.com/fusiontables/v1/query?sql=INSERT+INTO+".$tableid."+(username,description,latitude,longitud,geolocation)+VALUES+('".$username."','".$description."','".$latitude."','".$longitud."','".$geolocation."')&key={".$apikey."}";
Link generated: https://www.googleapis.com/fusiontables/v1/query?sql=INSERT+INTO+1X0rFoG7Tt2Ocm2rE39wPuamZCrFiS4D32Odgbh03+(username,description,latitude,longitud,geolocation)+VALUES+('webuser','nujkn','78','110','98.8789')&key={AIzaSyB4BMlrZIlJB-Apo8t_dO9K18uL8O2s5TA}
which in browser looks like: https://www.googleapis.com/fusiontables/v1/query?sql=INSERT+INTO+1X0rFoG7Tt2Ocm2rE39wPuamZCrFiS4D32Odgbh03+(username,description,latitude,longitud,geolocation)+VALUES+(%27webuser%27,%27nujkn%27,%2778%27,%27110%27,%2798.8789%27)&key={AIzaSyB4BMlrZIlJB-Apo8t_dO9K18uL8O2s5TA}