Stop watching google push notifications - google-admin-sdk

I am using the Google Reports API to watch for changes to resources, such as a user's Google Calendar activity events. To achieve this, a channel (or watchpoint) was created by following the steps here: https://developers.google.com/admin-sdk/reports/v1/reference/activities/watch
Now, I would like to stop watching a resource before the channel expires. I sent a POST request along with a access token in the header and the body contains the channel id and the resource id (https://developers.google.com/admin-sdk/reports/v1/reference/channels/stop). However I keep getting a 404 Not Found. Am I doing something wrong here?
All other requests using the same access token are working fine.
My request/response looks like this:
POST /admin/reports/v1/channels/stop HTTP/1.1
Host: www.googleapis.com
Content-length: 97
Content-type: application/json
Authorization: Bearer ya29.rAExOpnO_gatfyJvKWEVt8OsQ-LyaCyN3UUFjYzm0-3ExEBZ9an7WWfdDLqJspChQaiiIQ
{
"id": "5cfc250b-2faf-4f86-91b3-398326c6b4fb",
"resourceId": "A_HZ7mQy0Zpd6-TkQjr3aQlWd94"
}
HTTP/1.1 404 Not Found
Content-length: 9
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Vary: Origin,X-Origin
Server: GSE
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Fri, 10 Jul 2015 17:10:40 GMT
X-frame-options: SAMEORIGIN
Content-type: text/html; charset=UTF-8
Not Found

Turns out the request URL specified in the documentation is wrong.
The correct one is
https://www.googleapis.com/admin/reports_v1/channels/stop
Issue reported here: https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3914

Related

StatusCode: 403, ReasonPhrase: 'Forbidden' when doing prediction request in google ml in .net

I am currently working to make the prediction request using the library : Google.Apis.CloudMachineLearningEngine.v1 and ended up with a JSON return :
{
StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content:
System.Net.Http.StreamContent, Headers:
{
Vary: Origin
Vary: X-Origin
Vary: Referer
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
Transfer-Encoding: chunked
Cache-Control: private
Date: Mon, 13 Aug 2018 17:57:44 GMT
Server: ESF
Content-Type: application/json; charset=UTF-8
}
}.
My code is similar with this blog. (the last code he made)
I also have an editor role set up for that service account, (changed in IAM & ADMIN/IAM) and also added editor permission on ML Engine/Models/{model name} to that generated email.
I want to know if there is something I missed. I am running the code in asp.net in debug mode (via localhost). I just need a bit of clear information to make it work.

Update file request results in 404

I'm trying to update an existing file. The documentation says to use a PUT request with the file id and resumable as upload type.
However I'm getting a 404 with this request:
PUT /upload/drive/v3/files/*****?uploadType=resumable HTTP/1.1
Authorization: *****
Connection: keep-alive
Content-Length: 0
Date: Thu, 12 Jul 2018 20:20:08 GMT
X-Upload-Content-Type: image/jpeg
Host: www.googleapis.com:443
See the response:
HTTP/1.1 404 Not Found
X-GUploader-UploadID: *****
Vary: Origin
Vary: X-Origin
Content-Type: text/html; charset=UTF-8
Content-Length: 9
Date: Thu, 12 Jul 2018 20:20:07 GMT
Server: UploadServer
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
Changing to a PATCH request seems to solve the issue.
Could be wrong fileId as Remy suggests. Also could be a session expiry.
Or, could be a documentation error. The page you linked to says use PUT, but the reference page https://developers.google.com/drive/api/v3/reference/files/update says use PATCH

AWS Cognito - RESET_REQUIRED redirect not working

Currently I'm using the default UI from cognito to authenticate my users.
When i mark them as RESET_REQUIRED The redirect to forgot_password is not working.
Here's the request and Response Header...
HTTP/1.1 302 Found
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Date: Tue, 05 Jun 2018 21:22:15 GMT
Expires: 0
Location: redirect:/forgotPassword?redirect_uri=https://domain.delist&response_type=code&client_id=4711&errorMessage=Password reset required for user due to security reasons.
Pragma: no-cache
Server: Server
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Content-Length: 0
Connection: keep-alive
Any Idea or do i miss somthing?
I think your Location header is incorrect - try removing the "redirect:" so it is
Location: /forgotPassword?redirect_uri=https://domain.delist&response_type=code&client_id=4711&errorMessage=Password reset required for user due to security reasons.

what kind of data is transferred on the network in case of RESTful webservice

I know about the SOAP -based webservices that SOAP messages, which are XML in turn, are transferred on the network, from client to the server. But what kind of data is transferred in case of RESTful webservice ?
from Wikipedia https://en.wikipedia.org/wiki/Representational_state_transfer
RESTful systems typically, but not always, communicate over the
Hypertext Transfer Protocol with the same HTTP verbs (GET, POST, PUT,
DELETE, etc.)
You can try yourself easily with curl or Fiddler. For example GitHub API is nice to experiment with.
Send this with Fiddler:
GET https://api.github.com/users/octocat HTTP/1.1
Host: api.github.com
User-Agent: Fiddler
and you will get this response:
HTTP/1.1 200 OK
Server: GitHub.com
Date: Fri, 10 Jul 2015 10:23:10 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 1155
Status: 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1436527371
Cache-Control: public, max-age=60, s-maxage=60
Last-Modified: Mon, 06 Jul 2015 23:59:25 GMT
ETag: "d811d5844be3eaf9ab1f60dd36198aa9"
Vary: Accept
X-GitHub-Media-Type: github.v3; format=json
X-XSS-Protection: 1; mode=block
X-Frame-Options: deny
Content-Security-Policy: default-src 'none'
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 3EAD7342:6BF1:E180441:559F9D0D
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
Vary: Accept-Encoding
X-Served-By: bd82876e9bf04990f289ba22f246ee9b
{"login":"octocat","id":583231,"avatar_url":"https://avatars.githubusercontent.com/u/583231?v=3","gravatar_id":"","url":"https://api.github.com/users/octocat","html_url":"https://github.com/octocat","followers_url":"https://api.github.com/users/octocat/followers","following_url":"https://api.github.com/users/octocat/following{/other_user}","gists_url":"https://api.github.com/users/octocat/gists{/gist_id}","starred_url":"https://api.github.com/users/octocat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/octocat/subscriptions","organizations_url":"https://api.github.com/users/octocat/orgs","repos_url":"https://api.github.com/users/octocat/repos","events_url":"https://api.github.com/users/octocat/events{/privacy}","received_events_url":"https://api.github.com/users/octocat/received_events","type":"User","site_admin":false,"name":"The Octocat","company":"GitHub","blog":"http://www.github.com/blog","location":"San Francisco","email":"octocat#github.com","hireable":false,"bio":null,"public_repos":5,"public_gists":8,"followers":1054,"following":6,"created_at":"2011-01-25T18:44:36Z","updated_at":"2015-07-06T23:59:25Z"}
The following link answered my query. Now I know that the data sent in case of RESTful services is 'raw http' data.
http://rest.elkstein.org/2008/02/how-simple-is-rest.html

Sitecore Item Web API - Template item not found error

I am trying to create a item via Item Web Api and I am not being able to figure out what is wrong with my call.
The template ID does exist as well as the parent ID.
POST:
POST /-/item/v1/?name=Foo&template=%23%7b57ABCEB7-25E5-4F73-88D8-9E66E79EA87C%7d%23&sc_database=master&payload=Content&fields=DataTest&sc_itemid=%23%7b110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9%7d%23 HTTP/1.1
X-Scitemwebapi-Username: sitecore\admin
X-Scitemwebapi-Password: b
Content-Type: application/x-www-form-urlencoded
Host: sandbox
Content-Length: 14
Expect: 100-continue
Proxy-Connection: Close
DataTest=Value
RESPONSE:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
Date: Wed, 19 Mar 2014 00:25:34 GMT
Content-Length: 65
{"statusCode":500,"error":{"message":"Template item not found."}}
Any ideas?
Thanks a lot!
There are some extra encoded characters in the request URL, your template and sc_itemid parameters are wrapped in %23 (#) characters.
POST
/-/item/v1/?name=Foo&template=%23%7b57ABCEB7-25E5-4F73-88D8-9E66E79EA87C%7d%23&sc_database=master&payload=Content&fields=DataTest&sc_itemid=%23%7b110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9%7d%23
HTTP/1.1
Check your code to make sure how they got there but removing them should fix the issue.