I like to create a webhook for HipChat so that e.g. when typing /sayhi in the chat, a simple Hi is returned.
I looked at their api https://www.hipchat.com/docs/apiv2/method/create_room_webhook where it is said to send a PUT to
/v2/room/{room_id_or_name}/extension/webhook/{key}
So I made the following script
curl -d '{"name":"simpletest","url":"http://myserser/myapp/myresource",
"pattern":"^\\/hello$","key":"my.simple.webhook","event":"room_message"}'
-H 'Content-Type: application/json'
https://our.hipchat.com/v2/room/2202432/extension
/webhook/my.simple.webhook?auth_token=token
but running this returns
{
"error": {
"code": 405,
"message": "<p>The method is not allowed for the requested URL.</p>",
"type": "Method Not Allowed"
}
}
Can someone explain how to set up this correctly ? Thanks for any help
Found finally https://developer.atlassian.com/hipchat/tutorials/building-a-simple-add-on-using-a-wizard where it is explained in detail and with this it was working.
At the end it was a misconfiguration on my side
Related
I am attempting to Retrieve Access Token following the directions in the api docs (https://quire.io/dev/api/)
Example curl request
curl -H "Content-Type: application/json" -X POST -d '{"grant_type":"authorization_code","code":"my_code","client_id":"my_client_id","client_secret":"my_client_secret"}' https://quire.io/oauth/token
I only receive this response:
{"error":"unsupported_grant_type","error_description":"The supported grant types are 'authorization_code', 'refresh_token'."}
Can you see anything wrong with my curl request?
by Anderson Reinkordt
sounds like a duplicate of: Exchange Quire authorization code for access token with GM_xmlhttpRequest
Explained/accepted in this response: https://stackoverflow.com/a/58370352/4740707
Since the error message is a bit misleading please vote for:
https://github.com/quire-api/quire-api/issues/9
I have took a errored loopback project for correction in which has a module let it be Provider it has a function Provider/Login comes with POST method... this is the error stated by the customer that if he gives gor example {"email":"xxx#gmail.com","password":"123456"} .
It's prompting with the error given below :
{
"error": {
"name": "Error",
"status": 401,
"message": "login failed",
"statusCode": 401,
"code": "LOGIN_FAILED"
}
}
I cant find what the Issue is though i have checked most of the code. I'm new to LOOPBACK so any kind help is welcomed. Thanks for your help.
Smmith, It is clearly showing that error code is 401 which means unauthorize. which means the credentials are wrong.
Please create a user with these credentials before putting the login call.
If your Provider belongs to a USER class, than you can use the create call of provider to create the user first.
In developing to the Nest Cloud API I've tested access using my developer pin code. The pin code is alpha-numeric and my question is:
During the authorization with the pin code, is the evaluation case insensitive or sensitive?
I.e. is 33HV7900 the same as 33hv7900?
Based on experimentation the :pin_code URL parameter in the CURL request below seems to produce an API access token regardless of case:
Request:
curl -X POST -H "Content-Type: application/json" 'https://api.home.nest.com/oauth2/access_token?client_id=:product_id&code=:pin_code&client_secret=:secret&grant_type=authorization_code'
Response:
{
"access_token": "my_token_here",
"expires_in": 315360000
}
I have obfuscated values in both the Request & Response.
I am trying to develop an ios app using the newly published NEST api but bit lost with their native documentation.
Question:I could get an access token but do not know the thermostat endpoint to query and update "Away" state
Any pointers will be greatly appreciated ..
I'm presuming you intend to use REST to query and update the away state since you mentioned "endpoint"? If not the other alternative is to use the firebase API. This is documented in the introduction section
To get the away status you'll need to query the structure/s
curl -v -L https://developer-api.nest.com/structures?auth=<AUTH_TOKEN>
The response shows the away state in addition to the thermostats/smoke co alarms in that structure.
{
"g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg": {
"away": "home",
"country_code": "US",
"name": "Home",
"smoke_co_alarms": [
"0NBM7-QfoLwhMldZ2CoIkQ7hRJoe1Jye"
],
"structure_id": "g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg",
"thermostats": [
"GM6Z9JpSKU6_ua8AfD6WRA"
],
"time_zone": "America/Los_Angeles"
}
}
To update the away state you would need to use the PUT http verb:
curl -v -L -X PUT "https://developer-api.nest.com/structures/g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg?auth=<AUTH_TOKEN>" -H "Content-Type: application/json" -d '{"away":"away"}'
Note that the ID used in the path parameter is the structure ID returned in the get response.
Hope that helps
Nagesh
Am reading this page by Boris Smus and tried to implement and everything is working good. The only problem is, the requests are failing after some time. Am using googleapis. As soon as I install my test extension and try to make some googleapi requests, they are passing. But aftersome time when I try the same they are failing.
In the background.js NET tab i see the following response.
{ "error": { "errors": [ { "domain": "global", "reason": "authError", "message": "Invalid Credentials", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Invalid Credentials" } }
If I just reload my extension everything is working fine again. Am thinking it is something to do with accesstoken but am not sure how/where to fix it.
Also what I observed from console tab of background.js page, google.isAccessTokenExpired() results in 'false' when everything is working. It returns TRUE when everything is failing. Where/How do I fix this problem.
Solved! Added the following code.
if(google.isAccessTokenExpired()) {
google.authorize(function() { myFunc(info); } );
}
Not sure why it dint't worked a while back. Now its working.
For me it worked fine for the userinfo API. But not for contacts API. The problem was solved by changing the Url for contacts from http to https
So the Url I used: https://www.googleapis.com/m8/feeds/contacts/default/full