I've created project and registered it using https://code.google.com/apis/console
(I've choosen "other" application type).
Then I got "Client ID" for installed applications.
Then I went to console and created event, and authorised using oauth 2.
https://developers.google.com/google-apps/calendar/v3/reference/events/insert
Everything worked fine.
POST https://www.googleapis.com/calendar/v3/calendars/primary/events?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: xxx
X-JavaScript-User-Agent: Google APIs Explorer
{
"end": {
"dateTime": "2013-1-16T10:00:00.000-07:00"
},
"start": {
"dateTime": "2013-1-16T10:00:00.000-07:00"
}
}
Response
200 OK
- Show headers -
{
"kind": "calendar#event",
"etag": "\"WANTVF5ixxZ04U_VtQ0AZ3MbAlM/Z2NhbDAwMDAxMzY1NjU0MzAwNTk1MDAw\"",
"id": "2nsuis19mkp2q0uef54tl5nk68",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=Mm5zdWlzMTlta3AycTB1ZWY1NHRsNW5rNjggaXZhbjEzMzEzM0Bt",
"created": "2013-04-11T04:25:00.000Z",
"updated": "2013-04-11T04:25:00.595Z",
"creator": {
"email": "ivan133133#gmail.com",
"displayName": "ivan rozhcov",
"self": true
},
"organizer": {
"email": "ivan133133#gmail.com",
"self": true
},
"start": {
"dateTime": "2013-01-16T21:00:00+04:00"
},
"end": {
"dateTime": "2013-01-16T21:00:00+04:00"
},
"iCalUID": "2nsuis19mkp2q0uef54tl5nk68#google.com",
"sequence": 0,
"reminders": {
"useDefault": true
}
}
Then I copied id and updated this event.
https://developers.google.com/google-apps/calendar/v3/reference/events/update update
First time I got 200 response.
PUT https://www.googleapis.com/calendar/v3/calendars/primary/events/2nsuis19mkp2q0uef54tl5nk68?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29.AHES6ZRmo6pdxj8pY4NmzdI1estRNB-v87XV7xQHgyhrWHk2rzs3Ke8
X-JavaScript-User-Agent: Google APIs Explorer
{
"end": {
"dateTime": "2013-1-16T10:00:00.000-07:00"
},
"start": {
"dateTime": "2013-1-16T10:00:00.000-07:00"
}
}
But when I tried this again, I always got 400 error, error text is written below.
https://developers.google.com/google-apps/calendar/v3/reference/events/update update
400 Bad Request
cache-control: private, max-age=0
content-encoding: gzip
content-length: 123
content-type: application/json; charset=UTF-8
date: Wed, 10 Apr 2013 12:49:29 GMT
expires: Wed, 10 Apr 2013 12:49:29 GMT
server: GSE
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value"
}
],
"code": 400,
"message": "Invalid Value"
}
}
Can anyone explain, if that's google.api bug, or maybe I'm mistaken somwhere?
I've tryed it from differret account and PC (throught Google APIs Explorer and python library with same result)
Today I've tried to reproduce that bug. But everring works fine now.
I've created an issue in google code
http://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3371&thanks=3371&ts=1365599378
Still without answer.
I think it's was temporaru bug.
400 almost always means a simple syntax error in your auth URL. The most common cause is that you’ve either failed to URL-escape your scope or redirect, or alternatively URL-escaped it more than once.
Check this: Google Calendar API - can only update event once
and this: Google Calendar api v3 re-update issue
Sequence number needs to be increased when you change date/time of event, that is the reason why you are getting 400 - Bad request.
This is how I solved it using java client library.
mGoogleCalendarEvent contains updated information about event. First, get sequence number of this event from GoogleCalendar:
mGoogleCalendarEvent.setSequence(mService.events().get(mCalendarId,mGoogleCalendarEvent.getId()).execute().getSequence());
And then perform update:
mService.events().update(mCalendarId, mGoogleCalendarEvent.getId(),mGoogleCalendarEvent).execute();
I used patch instead of update and it works fine by now. But don't realy understand why update succeded first time and failed second and other times. Total mystery.
Discovered the exact same problem when accessing the Google Calendar API with the Google APIs Client Library for Javascript. It happens if I try to update the start date of a calendar event. Updating the end data is no problem. Really weird.
Fortunately, I was able to fix the issue by replacing update with patch too.
Related
Trying to migrate our calls away from the v2/ugcPosts endpoint to the new /rest/posts endpoint. I started off trying to create a text-only post as per the Text-Only Post Creation Sample Request
I copied and pasted the request body, changed the organization ID to my own, and included Authorization: Bearer {My Authorization Token}, X-Restli-Protocol-Version: 2.0.0, Content-Type: application/json, LinkedIn-Version:202207 as headers.
POST https://api.linkedin.com/rest/posts
{
"author": "urn:li:organization:***",
"commentary": "Sample text Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
However, when trying to post, I keep getting this 400 error.
{
"errorDetailType": "com.linkedin.common.error.BadRequest",
"code": "MISSING_REQUIRED_FIELD_FOR_DSC",
"message": "Field /adContext/dscAdAccount is required when the post is a Direct Sponsored Content, but missing in the request",
"errorDetails": {
"inputErrors": [
{
"description": "Field /adContext/dscAdAccount is required when the post is a Direct Sponsored Content, but missing in the request",
"input": {
"inputPath": {
"fieldPath": "/adContext/dscAdAccount"
}
},
"code": "MISSING_REQUIRED_FIELD_FOR_DSC"
}
]
},
"status": 400
}
I see that lifecycleState, distribution, visibility, commentary, author are all required, but adContext should be an optional field. I'm not sure what part of my request is indicating I'm trying to make a Direct Sponsored Content post - can someone take a look?
I've already tried
Removing the targetEntities and thirdPartyDistributionChannels parameters.
Removing isReshareDisabledByAuthor and the above.
Changing the feedDistribution to MAIN_FEED and NONE
Creating the post via the /v2/ugcPosts endpoint - meaning the authorization token and organization urn are correct
I am trying to learn how to update values on Wikidata using the API. Login and csrf cookies work ok, but when I try to update a value I get an invalid-snak error.
The request body looks like this:
POST /w/api.php HTTP/1.1
Accept-Encoding: gzip
Content-Length: 178
User-Agent: Mojolicious (Perl)
Host: test.wikidata.org
Content-Type: application/x-www-form-urlencoded
Cookie: [omitted]
action=wbcreateclaim&bot=1&entity=Q3345&format=json&property=P9876&snaktype=value&token=[omitted]&value=%7B%22entity-type%22%3A%22Q1917%22%7D
and the response is:
{
"error": {
"code": "invalid-snak",
"info": "Invalid snak data.",
"messages": [
{
"name": "wikibase-api-invalid-snak",
"parameters": [],
"html": {
"*": "Invalid snak data."
}
}
],
"*": "See https://test.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
},
"servedby": "mw1386"
}
I've tried various ways to succeed with an update by changing the value - no results. The only update I succeeded with is one with snaktype=novalue - which would confirm that the issue is with the snak vaue alone.
So the question is, what's the right way to make an update to a snakvalue?
The problem is that you are stating value={"entity-type":"Q1917"}, but Q1917 is not an entity-type!
You should instead state value={"entity-type":"item","numeric-id":1917}.
For deepen the topic, see the Wikidata API's documentation.
I'm trying to deploy a larger rules files to Firestore. The rules file is currently at 55KB (well below Firestore's listed limit of 256KB). Every time I attempt to simply deploy the rules by themselves using this command...
firebase deploy --only firestore:rules --debug
I get this error...
Error: HTTP Error: 400, Request contains an invalid argument.
[2020-09-13T19:29:41.552Z] Error Context: {
"body": {
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
},
"response": {
"statusCode": 400,
"body": {
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
},
"headers": {
"vary": "X-Origin, Referer, Origin,Accept-Encoding",
"content-type": "application/json; charset=UTF-8",
"date": "Sun, 13 Sep 2020 19:29:41 GMT",
"server": "ESF",
"cache-control": "private",
"x-xss-protection": "0",
"x-frame-options": "SAMEORIGIN",
"x-content-type-options": "nosniff",
"alt-svc": "h3-29=\":443\"; ma=2592000,h3-27=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
"accept-ranges": "none",
"transfer-encoding": "chunked"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "firebaserules.googleapis.com",
"port": 443,
"hostname": "firebaserules.googleapis.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/v1/projects/brianneisler-test:test",
"path": "/v1/projects/brianneisler-test:test",
"href": "https://firebaserules.googleapis.com/v1/projects/brianneisler-test:test"
},
"method": "POST"
}
}
}
I ran through a test where i commented out all of the rules code and then slowly uncommented portions of it based on dependency (looking for a problematic line). However, what I noticed is that as I uncommented more and more code the problem started happening more frequently. At first it would fail 1 in 5 times. Uncomment more code, started failing more frequently. This leads me to believe that there is some kind of race condition based on compilation time on Firebase's side since the size of the file remained the same, only the code that was uncommented changed.
I have reached out to Firebase's support team and they have verified that there are no errors in the rules themselves. They have been able to reproduce the error but their suggestions of how to workaround the issue have not worked. Here's the response I received from their support team.
Thanks for the detailed information. I made some tests using the rules you shared, it seems that the rules have the correct syntax, but there are too many rules to update in the Firebase console at a time.
One option is uploading the rules in chunks. First, try uploading the first 1500 lines of the rules and publish the rules. After that add the rest code lines, it should be like 400, and publish the rules once again, it should not send the error this time.
I also tried deploying the rules using the Firebase CLI. When I tried to deploy the functions the first time it showed me the same error as you, but I tried to deploy the functions one more time and it did it correctly.
It's clear they're running into the same issue where this will occasionally fail.
Has anyone else run into this issue and figured out a way to work around it?
Current workaround
If i minimize the rules using the firemin rules minifier, the deployment succeeds more often. This makes sense since it collapses single use functions and overall reduces the size of the rules file.
I'm using PayPal Payouts in my project. I found an issue when creating a Payout. The request is made on Postman (Windows), and Node.js using axios (Firebase Functions).
I received a response MALFORMED_REQUEST_ERROR on this request:
POST https://api.sandbox.paypal.com/v1/payments/payouts
{
"sender_payout_header": {
"sender_batch_id": "2018083001",
"email_subject": "You have a payout!"
},
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": "9.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"sender_item_id": "2018083001001",
"receiver": "receiver#example.com"
}
]
}
I tried changing items[0]/note to a test value: POSPYO001, the API will response 201 Created as expected.
Why the sandbox is working only on positive/negative test values ? Is this a limitation, or a bug ?
P.S. Sorry for my english.
I'm trying to remove some attendees from a Google Calendar Event, which relates to a room resource calendar, while using the tool on the API documentation Try It API Explorer, properly authorized using a domain admin account which has admin rights over that calendar,
I'm sending a request body deleting two attendees from the event, the API results is 200 OK, but the attendees remains there..
I've tried to add a new attendee or updating it's status and it works ok, but not for removing the attendee..
Any body know what I'm missing here? I've also tried using this through GAS and I'm experiencing the same issue, but to discard any self programming issue I've tried with the official API Try It tool
Request
PATCH
https://www.googleapis.com/calendar/v3/calendars/supportworld.com.ar_34373XXXXXXXXXXX2%40resource.calendar.google.com/events/osrd3lXXXXXXXolks?fields=attendees%2Cid&key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29.bwAXXXXXXXXJOeCUAAADDYWT-QXXXXXXXXXXrc_eGP6Lk7CXXXXXXXXJ6130__ci_-_YXXXXxs
X-JavaScript-User-Agent: Google APIs Explorer
{
"attendees": [
{
"organizer": true,
"email": "xxxxx#netuxxxxxxrp.com",
"responseStatus": "accepted",
"displayName": "AAAAAAA"
},
{
"self": true,
"resource": true,
"email": "supportworld.com.ar_34373XXXXXXXXXXX2#resource.calendar.google.com",
"responseStatus": "accepted",
"displayName": "Cafetera"
}
],
"id": "osrd3lXXXXXXXolks
"
}
Response
200 OK
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-encoding: gzip
content-length: 294
content-type: application/json; charset=UTF-8
date: Thu, 28 Aug 2014 16:15:06 GMT
etag: "XXXXXXXXX"
expires: Fri, 01 Jan 1990 00:00:00 GMT
pragma: no-cache
server: GSE
{
"id": "osrd3lids0gkoeaggp2c95olks",
"attendees": [
{
"email": "xxxxx#netuxxxxxxrp.com",
"displayName": "AAAAAAA",
"organizer": true,
"responseStatus": "accepted"
},
{
"email": "yyyyy#netuxxxxxxrp.com",
"displayName": "YYYYYYY",
"responseStatus": "accepted"
},
{
"email": "zzzzz#netuxxxxxxrp.com",
"displayName": "BBBBBB",
"responseStatus": "needsAction"
},
{
"email": "supportworld.com.ar_34373XXXXXXXXXXX2#resource.calendar.google.com",
"displayName": "Cafetera",
"self": true,
"resource": true,
"responseStatus": "accepted"
}
]
}
the entries:
{
"email": "yyyyy#netuxxxxxxrp.com",
"displayName": "YYYYYYY",
"responseStatus": "accepted"
},
{
"email": "zzzzz#netuxxxxxxrp.com",
"displayName": "BBBBBB",
"responseStatus": "needsAction"
}
shouldn't be there any more, but they are.. any help on this appreciated,
I was able to get it to work. I think there's an issue with the API explorer tool.
Specifically, where you specify the patch body, there's a structured editor through which you can add and remove sections of the JSON for the attendees object. When I removed an attendee from the list using the structured editor, and then switched over to the freeform editor, the attendee was still there. Bug!
Staying in the freeform editor, I removed the desired attendee block again and executed, and everything worked the way it should. I verified in a separate tab with a GET that the attendee was indeed removed.
(To get to the different editors, there is a drop down button in the top right of the patch body text field.)
I have got it working in C#, I think in other languages it will work the same way.
When I tried to remove the unwanted attendee from the list, it did not work.
eventItem.Attendees.Remove(new EventAttendee { Email = "<to be removed>#gmail.com" });
I imagine you have got to this point.
But when I replaced the list with another list without the attendee, it worked and the other attendees were not even notified about any changes.
eventItem.Attendees = eventItem.Attendees.Where(a => a.Email != "<to be removed>#gmail.com").ToList();
and of course a patch / update afterwards.
service.Events.Patch(eventItem, "primary", eventItem.Id).Execute();