So we have been using the Flowdock Push API for quite some time now. We have been using it to push messages from our Continous Integration server (Electric commander) and it has been working pretty great. It's integrated into a powershell script today.
Now i have been notified that the PUSH API is deprecated and will be removed "some day" along with a refference to the REST API's message feature.
Following the documentation i have been able to add messages from my personal API token directly to the chat. However when i try to add a message to the inbox, with the flow API token, i keep getting 404's
I am using fiddler's compose feature to fiddle (ha!) with the examples from the dox (i have anonymized it a bit):
POST https://api.flowdock.com/MYORGANIZATION/MYFLOW/mesages
User-Agent: Fiddler
Host: api.flowdock.com
Content-Length: 593
Content-Type: application/json
Accept: application/json
{
"flow_token": "MYFLOWS API TOKEN",
"event": "activity",
"author": {
"name": "anttipitkanen",
"avatar": "https://avatars.githubusercontent.com/u/946511?v=2"
},
"title": "Opened pull request",
"thread_id": "WT5yWsIpdvUPxP07lfgQDmLoGQQ",
"external_thread_id": "github:component:pr:42",
"thread": {
"title": "Fix bug in thread API",
"body": "Body with <b>HTML<b> formatting",
"external_url": "https://github.com/flowdock/component/pull/42",
"status": {
"color": "green",
"value": "open"
}
}
}
Raw response is:
HTTP/1.1 404 Not Found
Date: Thu, 08 Oct 2015 10:02:34 GMT
Status: 404 Not Found
Content-Type: application/json
X-Request-Id: ab39438c-07b7-48bf-bde8-c3b29478094d
X-Runtime: 0.007442
Strict-Transport-Security: max-age=31557600
X-Server-Id: 3c4883af38147558374983c6d90b2bb9badb86d4
Vary: Accept-Encoding
Transfer-Encoding: chunked
20
{"message":"Resource not found"}
0
Is the flow_token the API token for my flow? Or is it the dev token i have to sign up for?
This is not meant to work as an application, i just wan't to push the status of builds and deploys to the other developers.
https://www.flowdock.com/api/message-types#/activity
The correct endpoint is https://api.flowdock.com/flows/ORG/FLOW/messages.
The flow_token is a bit confusingly named since it is not the flow API token, instead it is a source's flow_token. In order to get a flow_token to a source, you will need to create an application. Then create a source for it to a certain flow. Easiest way to do this is using the "Tools for testing" section in the application.
Lastly you probably want to use only the "external_thread_id".
Related
I have installed rest client extension in vs code, but when I create .rest file and make some requests I don’t see the send request link
GET http://localhost:3000/signin
You can add three # symbol after each request like below:
POST http://localhost:8800/api/carts/
Content-Type: application/json; charset=utf-8
{
"productId": "63c00763e65ebde449e9b411",
"quantity": "1"
}
3 '###' here
GET http://localhost:8800/api/carts/
I'm using G-Suite google classroom API and I'm trying to add student to a course, I have enabled all administration permission to my account, I made sure I have all required scopes requested in the access token but still I'm getting PERMISSION_DENIED
POST /v1/courses/<courseId>/students HTTP/1.1
Host: classroom.googleapis.com
Content-length: 70
Content-type: application/json
Authorization: Bearer <accessToken>
{
"profile": {
"verifiedTeacher": true,
},
"userId": "studentId"
}
API Documentation
So My Question is why I'm still receiving this error? how to find the root cause of the problem?
I trying to use the Google OAuth 2.0 playground to query for realtime updates on a Google Docs File ID. For every request using either the get or update Realtime api calls I receive an error and have tried sending in numerous file ids. Do you have any advice as to how to use this API?
Below is the URL I am sending along with the error returned:
https://www.googleapis.com/drive/v2/files/1IT1qIuM6QsqV7D--69uv0sn4OSQ24UQKos3x0P3BQjc/realtime
Error Returned:
GET /drive/v2/files/1IT1qIuM6QsqV7D--69uv0sn4OSQ24UQKos3x0P3BQjc/realtime HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: Bearer ya29.LgDc0oNUU_4cuhoAAAAjT4pqiLwlIpoRV7ll_QEJp1QayB49KOwIYKHVK5rMww
HTTP/1.1 400 Bad Request
Content-length: 172
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Expires: Wed, 25 Jun 2014 10:08:21 GMT
Server: GSE
Cache-control: private, max-age=0
Date: Wed, 25 Jun 2014 10:08:21 GMT
X-frame-options: SAMEORIGIN
Content-type: application/json; charset=UTF-8
{
"error": {
"code": 400,
"message": "Invalid Value",
"errors": [
{
"domain": "global",
"message": "Invalid Value",
"reason": "invalid"
}
]
}
}
Thanks,
Michael
You need to provide your API key at the end. You can see what the requests should look like in the API explorer.
Note however that realtime documents are scoped to a particular app, so anything you've created in your app won't show up in the API explorer. You can update and the get it from that using the explorer app though.
I'm trying to understand (and eventually make it work) batch request on the google group API.
With Oauth2 Playground I know how to perform a single request with:
on step 1 authorised API are
https://www.googleapis.com/auth/admin.directory.group.member.readonly
https://www.googleapis.com/auth/admin.directory.group.member
https://www.googleapis.com/auth/admin.directory.group.readonly
https://www.googleapis.com/auth/admin.directory.group
on step 3 I'm making a post request with:
request URI: https://www.googleapis.com/admin/directory/v1/groups/mytestgroup#domain.ext/members
and the body is:
{
"email": "lya#example.com",
"role": "MEMBER"
}
So far so good, but now I'm trying to do the same in a batch request
I tried to follow the explanation here:
https://developers.google.com/admin-sdk/directory/v1/guides/batch#example
but I didn't understood everything so I went there:
https://developers.google.com/storage/docs/json_api/v1/how-tos/batch
So I did the following request with, on step 1 the same API but on step 3:
a post request to:
https://www.googleapis.com/batch
with a custom content-type:
the header is now
multipart/mixed; boundary="batch_foobarbaz"
and in the body request:
--batch_foobarbaz
Content-Type: application/http
POST /admin/directory/v1/groups/mytestgroup#domain.ext/members HTTP/1.1
Content-Type: application/json
content-length: 58
{
"email": "liz#example.com",
"role": "MEMBER"
}
--batch_foobarbaz--
I also tried different variants but I never get to do the correct request, I systematically get 400 error.
Can someone help me with that, I don't know what I can do to correct that.
Thanks in advance, Harold
Okey sorry for the inconvenience, I found my answer. Here is what I've done:
on step 1 authorised API are:
https://www.googleapis.com/auth/admin.directory.group.member.readonly
https://www.googleapis.com/auth/admin.directory.group.member
https://www.googleapis.com/auth/admin.directory.group.readonly
https://www.googleapis.com/auth/admin.directory.group
on step 3 I'm making a post request with:
https://www.googleapis.com/batch
with a custom content-type: multipart/mixed; boundary="batch_foobarbaz"
body request:
--batch_foobarbaz
Content-Type: application/http
Content-Transfer-Encoding: binary
POST /admin/directory/v1/groups/mytestgroup#domain.ext/members HTTP/1.1
Content-type: application/json
{"email": "ldn#example.com", "role": "MEMBER"}
--batch_foobarbaz--
the important part here are the carriage return. They are mandatory after Content-Transfer-Encoding: binary and after Content-type: application/json
i'm using the Explorer to just test out the API and get a feel for the data returned. On the top right corner of each API there is an "authorize using" switch. This asks me to auth with my google account. This all happens correctly and without error. When i try to use the "data.ga.get" method i get this error:
Request
GET https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A24351574&start-date=2011-01-01&end-date=2012-02-01&metrics=ga%3Apageviews&pp=1&key={YOUR_API_KEY}
Request
GET https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A24351574&start-date=2011-01-01&end-date=2012-02-01&metrics=ga%3Apageviews&pp=1&key={YOUR_API_KEY}
Authorization: OAuth ya29.AHES6ZSCqka0X1AVtMrW7iXn7VreLk71vfWB9MrnXCejBYY
X-JavaScript-User-Agent: Google APIs Explorer
Response
403 Forbidden
cache-control: private, max-age=0
content-type: application/json; charset=UTF-8
date: Tue, 28 Feb 2012 01:23:18 GMT
expires: Tue, 28 Feb 2012 01:23:18 GMT
server: GSE
{
"error": {
"errors": [
{
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
}
The strange thing is the auth works just fine for other API like calendar.
I'm not sure what i'm missing that would case this issue
A 401 Unauthorized and a 403 Forbidden are two different errors. But, make sure the Analytics service is turned on for your project in the API console: https://code.google.com/apis/console/.