I have followed the instruction for using the Outlook REST APIs webhook push notification.
I want push notification from the calendar for creating, updating and deleting event entities. I have called below request:
Method Type: Post
URL: https://outlook.office.com/api/v2.0/me/subscriptions
Content-Type : application/json
Authorization : Bearer ACCESS_TOKEN
Request Body :
{
"#odata.type": "#Microsoft.OutlookServices.PushSubscription",
"Resource": "https://outlook.office.com/api/beta/me/events",
"NotificationURL": "https://krogerfreshwebhook.ngrok.io/myNotifyClient",
"ChangeType": "Created",
"ClientState": "MySecretClientStateString"
}
But I am getting below error in response header
content-length : 0
date : Mon, 20 Nov 2017 12:58:03 GMT
request-id : 38ac0346-088f-4b43-80b2-32c6cf64b22c
status : 401
www-authenticate : Bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000#*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token",Basic Realm="",Basic Realm="",Basic Realm=""
x-backendhttpstatus : 401, 401
x-beserver : MA1PR01MB0485
x-calculatedbetarget : MA1PR01MB0485.INDPRD01.PROD.OUTLOOK.COM
x-calculatedfetarget : MA1PR01CU001.internal.outlook.com
x-diaginfo : MA1PR01MB0485
x-feproxyinfo : MA1PR01CA0025.INDPRD01.PROD.OUTLOOK.COM
x-feserver : MA1PR01CA0025, BM1PR01CA0075
reason="ErrorCode: 'PP_E_RPS_CERT_NOT_FOUND'
Message:
'Certificate cannot be found. Certificate required for the operation cannot be found.%0d%0a
Internal error: spRPSTicket->ProcessToken failed.
Failed to call CRPSDataCryptImpl::UnpackData:Certificate cannot be found. Certificate required for the operation cannot be found.%0d%0a Internal error: Failed to decrypt data. :Failed to get session key. RecipientId=293577. spCache->GetCacheItem returns error.:Cert Name: (null).
error_category="invalid_msa_ticket"
x-msedge-ref : Ref A: 0C4DE404A07C474FA67DC1A986C2DEA0 Ref B: BOM01EDGE0220 Ref C: 2017-11-20T12:58:03Zenter code here
x-powered-by : ASP.NET
Additional Information:
Authorization URL:
login.microsoftonline.com/common/oauth2/v2.0/authorize
?response_type=code
&client_id=my_clinet_id
&redirect_uri=my_redirect_url
&authorize
&scope=openid,offline_access,User.ReadWrite,Mail.ReadWrite,Contacts.ReadWrite,Tasks.ReadWrite,Calendars.ReadWrite,Calendars.ReadWrite.Shared,Mail.Send,Group.Read.All,Files.ReadWrite,Files.ReadWrite.All
When I call calendar api then it is working fine. It is giving me event list of calendar but when I use the same token for subscription of push notification then it is giving me invalid token error
Related
I have an azure cognitive search service that I am trying to add an azure blob storage data source via the api. Creating it works fine via the portal.
Here is the uri:
https://xxxxxx.search.windows.net/datasources?api-version=2019-05-06
Here are the headers:
User-Agent: Fiddler
Content-Type: application/json
api-key: XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Host: XXXXXXXXXX.search.windows.net
Content-Length: 412
Here is the body:
{
"name" : "documents",
"description" : "documents data source",
"type" : "'azureblob",
"credentials" :
{ "connectionString" :
"XXXXXXXXX"
},
"container" : { "name" : "documents" }
}
When I run it, I get a 400 error code with the following message:
{"error":{"code":"","message":"Data source type ''azureblob' is not
supported"}}
I got the enum value straight from the docs here. Am I missing something?
Thanks in advance
So it was a copy/paste error from the docs:
"azureblob" <> "azureblob "
Angular version is 1.3.13
I'm making a url request to a public url to get some data. For one url it functions but for the other it does not. I have no control over the server side.
The URL returns with 200 but AngularJS passes it to the error function. In my browser console the data is there, as JSON, but I do not have access to it in Angular. I was thinking it might the the http.get calling something before passing the data on.
I've tried with plain $http and a custom transformResponse but it still falls to the error of the custom response.
This is the URL:
https://uatmerchant.sixdots.be/oidc/.well-known/openid-configuration
These are the response headers from the URL:
Connection
close
Content-Security-Policy
reflected-xss block
Content-Type
application/json
Date
Mon, 15 Jan 2018 12:33:30 GMT
Set-Cookie
BIGipServer~DMZ~pool_uat_5000=…omain=.uatmerchant.sixdots.be
Strict-Transport-Security
max-age=15552000; includeSubDomains
Transfer-Encoding
chunked
X_CORRELATION_ID
UAT-MER-F5-20180115133330632
X-Content-Security-Policy
reflected-xss block
X-Content-Type-Options
nosniff
X-Frame-Options
SAMEORIGIN
X-Xss-Protection
1; mode=block
This is part of the data that is in the response in the browser console
request_parameter_supported true
claims_parameter_supported false
scopes_supported […]
0 openid
1 profile
2 email
3 address
4 phone
issuer https://uatmerchant.sixdots.be/oidc
acr_values_supported […]
0 tag:sixdots.be,2016-06:acr_basic
Here is the code making the call with the URL that is detailed at the start of this post above
var oohahhel = $sce.trustAsResourceUrl(urlVar);
$http.get(oohahhel)
.then(
function success(response){
var jsonResponse = angular.fromJson(response);
//process response
}
,function error(reason){
//process error
});
I have a Jersey REST application in Websphere 8.5. Whenever my resource responds with a 4xx response, Webpshere (or IBM Http Server) overwrites the response body with its default error message, for example:
Error 404: Not Found
Not only don't I want the response body to be overwritten, I want the response body as produced by my resource, but also Websphere does not update the Content-Length: response header, thereby creating an inconsistency between content-length and the actual response body length.
Is there a way to force Websphere (or IBM HTTP server) to not overwrite the response body when my resource produces a 4xx response?
For example a call to the following resource:
#Path("timeout")
public class TimeoutService {
#GET
#Path("withbody")
#Produces(MediaType.APPLICATION_JSON)
public Response getWithBody() {
Response.ResponseBuilder builder = Response.status(Response.Status.NOT_FOUND);
builder.entity("{ \"status\" : \"notok\" }");
return builder.build();
}
}
will result in:
Error 404: No
Request Method:GET
Status Code:404 Not Found
Response Headers
$WSEP:
Connection:Keep-Alive
Content-Language:en-US
Content-Length:13
Content-Type:text/html;charset=ISO-8859-1
Date:Tue,21 Apr 2015 11:50:38 GMT>
Keep-Alive:timeout=15, max=100
X-Powered-By:Servlet/3.0
Note how the default message gets truncated because of the inconsistent content length.
But what I want is this call to respond with a 404 and { "status" : "notok" } and Content-Type set to application/json
Yes, you can. Here is the page that outlines the Jersey property that needs to be changed to disable WAS hi-jacking your errors:
https://java.net/jira/browse/JERSEY-2521
In short, you have to set the property org.glassfish.jersey.server.ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR to true when you configure Jersey.
I want to get the ID of the Inbound message in my implemented service end point which has following parameters available:
Custom JAXB Request
#Context HttpServletRequest
e.g. From below inbound message i want to retrieve ID: 1 in my service endpoint.
INFO: Inbound Message
ID: 1
Address:
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/xml
Headers:
Payload:
Can anyone please tell me if there is a way to get that ID ?
You can get the current CXF Message using PhaseInterceptorChain.getCurrentMessage(). The logging ID used by the logging interceptors is stored in the Message Map, and can be retrieved with its key, e.g.
String loggingId = (String) PhaseInterceptorChain.getCurrentMessage().get(LoggingMessage.ID_KEY);
In the Cloud Endpoints documentation for exception handling, it is recommended to subclass the endpoints.ServiceException class to provide a custom http_status for 409 Conflict errors. This answer to another question indicates that some of the supported status codes get mapped by Google's infrastructure to other status codes, but 409 isn't one of the mapped status codes.
Using the ConflictException class from the documentation:
import endpoints
import httplib
class ConflictException(endpoints.ServiceException):
"""Conflict exception that is mapped to a 409 response."""
http_status = httplib.CONFLICT
When I raise the ConflictException:
#endpoints.method(request_message=apimodels.ClientMessage,
response_message=apimodels.ClientMessage,
name='insert',
path='/clients',
http_method='POST'
)
def insert(self, request):
client = models.Client.get_by_id(request.client_code)
if client:
raise ConflictException('Entity with the id "%s" exists.' % request.client_code)
...
I'm getting a 400 Bad Request as the response:
400 Bad Request
Content-Length: 220
Content-Type: application/json
Date: Thu, 27 Feb 2014 16:11:36 GMT
Server: Development/2.0
{
"error": {
"code": 400,
"errors": [
{
"domain": "global",
"message": "Entity with the id \"FOO\" exists.",
"reason": "badRequest"
}
],
"message": "Entity with the id \"FOO\" exists."
}
}
I'm getting the same 400 response code on both the local dev_appserver and deployed to App Engine (on 1.9.0). Stepping into the App Engine ProtoRPC code, the following line appears to be mapping all remote.ApplicationError types to a 400 status code.
If I update the endpoints.apiserving._ERROR_NAME_MAP dict to add my custom ConflictException class, I'm able to return a 409 successfully:
import endpoints
import httplib
from endpoints.apiserving import _ERROR_NAME_MAP
class ConflictException(endpoints.ServiceException):
"""Conflict exception that is mapped to a 409 response."""
http_status = httplib.CONFLICT
_ERROR_NAME_MAP[httplib.responses[ConflictException.http_status]] = ConflictException
Is this the correct way to implement endpoints.ServiceException subclasses?
It seems to be a bug as according to the bug report filed by Chris.