Upwork API list teams return 400 error (Bad Request: Maximum 50 items per bulk request) - upwork-api

I making GET request to /api/hr/v2/teams.json (according to https://developers.upwork.com/?lang=php#companies-and-teams_list-teams) and receive the error:
{"server_time":1660924546,"error":{"status":400,"code":0,"message":"Bad Request: Maximum 50 items per bulk request."}}'
In API description I do not see any param possible to limit request. Can anyone suggest solution?
Thank you in advance!
Alex

Related

Google API limit errors thrown when not even close to limits

I'm using Google Sheet API in 4 different apps.
In 2 of them I'm getting this error far before I actually reach the limit:
GSheet error: rateLimitExceeded: Quota exceeded for quota group 'ReadGroup' and limit 'Read requests per user per 100 seconds' of service 'sheets.googleapis.com' for consumer 'project_number:xxx'.
I also get the same error but for writing.
You can see here, my limits are 500 requests per 100 seconds, and I max out around 15, yet I still get this error a LOT.
Any ideas?

Getting 401 Unauthorized error when threads in JMeter increase

I am running a JMeter script, where I get the Access Token which I use it for my HTTP Request Samplers (By using Bearer ${AccessToken} in Header Manager of each Request). My HTTP Requests are being categorized into multiple Simple Controllers.
There are 70 HTTP GET Requests and ONE Thread takes around 20 seconds to execute them all.
Now when my no. of threads increase, say 3 onwards, then I start getting 401 Errors
({
"statusCode": 401,
"error": "Unauthorized",
"message": "Bad token",
"attributes": {
"error": "Bad token"
}
})
for a few requests. But eventually 401 errors start getting high as no. of Threads increase, keeping Ramp Up time low. for eg: for 5 Requests Ramp Up time = 30 sec.
JMeter Script snapshot
I have checked, my Access Token call always return a different token which is used per new THREAD. so not sure where the issue is :(
So far I have not used any think times, maybe that is one of the issue, but not sure.
By looking at your http get response , The issue is caused most likely due to incorrect value of AccessToken.
Make sure you are passing correct AccessToken to get response.
IF you have a recorded script log, check where this access token originating from and make sure your regular expression extractor is extracting it correctly.
For more information on extracting variables and reusing it in the script you can read this article.

1 MB response size limit with outlook web add-ins

I'm using makeEwsRequestAsync to get the full MIME content of the email. But it looks like response size is capped at 1 MB, per the error message in the response:
"ErrorMessage":"Response exceeds 1 MB size limit. Please modify your EWS request.”
<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
<t:AdditionalProperties>
<t:FieldURI FieldURI="item:MimeContent"/>
</t:AdditionalProperties>
</ItemShape>
<ItemIds><t:ItemId Id="' + itemId + '"/></ItemIds>
</GetItem>
I need to get MIME content of messages which may exceed 1 MB, and also POST such content to our server. Is there any way to increase this limit in the request, or configure this on the Exchange side?
It is not possible to make EWS requests to the client side that exceed 1 MB, however you can give your server the information that it needs to make the request itself.
You first need to call Office.context.mailbox.getCallbackTokenAsync which will give you a token you can use to make EWS requests from your server.
Then you will need to get the item ID which is available through Office.context.mailbox.item.itemId.
Finally, you need the url to make the request to, which is Office.context.mailbox.ewsUrl
With these 3 pieces of information, your server can make the SOAP call to EWS from your backend, and bypass the 1 MB limit imposed on the client. At this point, you can pass whatever information needed back to your client.

Unable to get results more than 100 results on google custom search api

I need to use Google Custom Search API https://developers.google.com/custom-search/v1/overview. From that page, it said:
For CSE users, the API provides 100 search queries per day for free.
If you need more, you may sign up for billing in the Developers
Console. Additional requests cost $5 per 1000 queries, up to 10k
queries per day.
I already sign up for billing inside the developer console. However, I still could not retrieve results more than 100. What things should I do more? https://www.googleapis.com/customsearch/v1?cx=CSE_INSTANCE&key=API_KEY&q=QUERY&start=100
{ error: { errors: [ { domain: "global", reason: "invalid", message:
"Invalid Value" } ], code: 400, message: "Invalid Value" } }
Query: Definition
https://support.google.com/customsearch/answer/1361951
Any actual user query from a Google Site Search engine, including but
not limited to search engines installed on your website using XML,
iFrame, or the Custom Search Element.
That means you would probably need to send eleven queries to get more than 100 results.
GET https://www.googleapis.com/customsearch/v1?&q=QUERY&...&start=1
GET https://www.googleapis.com/customsearch/v1?&q=QUERY&...&start=11
GET https://www.googleapis.com/customsearch/v1?&q=QUERY&...&start=21
GET ...
GET https://www.googleapis.com/customsearch/v1?&q=QUERY&...&start=81
GET https://www.googleapis.com/customsearch/v1?&q=QUERY&...&start=91
GET https://www.googleapis.com/customsearch/v1?&q=QUERY&...&start=101
Check every response and if error code is 400, you can stop - there is probably no need to send next (&start=previous+10) request.
Now you can merge responses and start building results page.
Google Custom Search and Google Site Search return up to 10 results
per query. If you want to display more than 10 results to the user,
you can issue multiple requests (using the start=0, start=11 ...
parameters) and display the results on a single page. In this case,
Google will consider each request as a separate query, and if you are
using Google Site Search, each query will count towards your limit.
There might be a better way to do this then I described above. (But, I'm not sure about batching API calls.)
And (finally) possible answer to your question: I made more than few tests, but I haven't had any luck with start greater than 100 (I was getting the same as you - <Response [400]>). I'm using "Browser key" from my billing-enabled project. That could mean we can't get 101st, 102nd, 103rd, etc. results with CSE API.
The API documentation says it never returns more than 100 items.
https://developers.google.com/custom-search/v1/reference/rest/v1/cse/list
start
integer (uint32 format)
The index of the first result to return. The default number of results
per page is 10, so &start=11 would start at the top of the second page
of results. Note: The JSON API will never return more than 100
results, even if more than 100 documents match the query, so setting
the sum of start + num to a number greater than 100 will produce an
error. Also note that the maximum value for num is 10.

How to test our code to send 400 queries per user per minute in Gatling

I want to limit server calls to 400. For that I need to check if I pass 400+ queries will it give me error.
And how write code for 1 user repeated 400 times over a minute.
val UIScenario = scenario("UI Simulation")
.repeat(400)
{
exec(loginScns).exec(search)
}
setUp(
delphiUIScenario.inject(rampUsers(1) over(1 second))
).protocols(httpProtocol)
Please help to sort out this
Thanks !!!!!!!!!!!!
For such as scenarios you can use Apache Benchmark tool. Here is homepage and documentation of it.
http://httpd.apache.org/docs/2.2/en/programs/ab.html

Resources