Is there an Outlook REST API that gives me all the urls extracted from the body of the message? Some thing like what EWS's EntityExtractionResult does?
No there isn't. However, you can retrieve extended properties, so you should be able to request the PidNameExtractedUrls property.
If you dig through those open specs, you should find these details on PidNameExtractedUrls:
Property set: PSETID_XmlExtractedEntities {23239608-685D-4732-9C55-4C95CB4E8E33}
Property name: XmlExtractedUrls
So that would mean I could make the following request (assuming you're using the Outlook endpoint, not Graph):
GET https://outlook.office.com/api/v2.0/me/messages?$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String {23239608-685D-4732-9C55-4C95CB4E8E33} Name XmlExtractedUrls')
For Graph, you would replace PropertyId with id.
That will include something like this in the message entities that have this property set:
"SingleValueExtendedProperties": [
{
"PropertyId": "String {23239608-685d-4732-9c55-4c95cb4e8e33} Name XmlExtractedUrls",
"Value": "<?xml version=\"1.0\" encoding=\"utf-16\"?><UrlSet><Version>15.0.0.0</Version><Urls><Url StartIndex=\"0\"><UrlString>https://www.google.com</UrlString></Url><Url StartIndex=\"23\"><UrlString>https://developer.microsoft.com/outlook</UrlString></Url></Urls></UrlSet>"
}
]
Related
I am trying to retrieve data from the Betfair API and have to send some extra info as headers and Json data. Details below:
Url:
https://api.betfair.com/exchange/account/json-rpc/v1
Headers:
{ 'X-Application' :'exampleappid', 'X-Authentication' :'examplesessionkey','Content-Type':'application/json' }
formdata:
{"jsonrpc": "2.0","method": "AccountAPING/v1.0/getAccountStatement", "params": {"itemDateRange":{},"includeItem":"ALL"}, "id": 1}
Currently in excel I go to the Data tab then click on New Query>From Other Sources>From Web>Advanced then I type in the url and the headers in the respective fields. Where do I put in the other form data, or its just not possible?
Edit:
I have created the following query in the query editor :
let
formdata = "{""jsonrpc"": ""2.0"",""method"": ""AccountAPING/v1.0/getAccountStatement"", ""params"": {""itemDateRange"":{},""includeItem"":""ALL""}, ""id"": 1}" ,
Source = Web.Contents("https://api.betfair.com/exchange/account/json-rpc/v1",[Headers= [#"X-Application"="appkey", #"X-Authentication"="sessionkey", #"Content-Type"="application/json"],
Content=Text.ToBinary(formdata)])
in
Source
and I get the following error DataSource.Error: The server committed a protocol violation. Section=ResponseHeader Detail=Header name is invalid
Details:
https://api.betfair.com/exchange/account/json-rpc/v1
Unfortunately I don't think there is a field in the UI for web connections to set the formdata, but it can be done by manually setting up the connection. I think what you have without the formdata would look like this in the M code
Web.Contents(
"https://api.betfair.com/exchange/account/json-rpc/v1",
[Headers=[#"X-Application"="exampleappid", #"X-Authenticaion"="examplesessionkey", #"Content-Type"="application/json"]]
)
There is a "Content" field that can be added after the Headers. In most examples I've seen (and I recall doing this myself once though I don't remember what for), you setup a string for the form data and use Text.ToBinary before passing it into the Content field. So a full query would look something like this:
let
formdata = "{""jsonrpc"": ""2.0"",""method"": ""AccountAPING/v1.0/getAccountStatement"", ""params"": {""itemDateRange"":{},""includeItem"":""ALL""}, ""id"": 1}" ,
Source =
Web.Contents(
"https://api.betfair.com/exchange/account/json-rpc/v1",
[
Headers=[#"X-Application"="exampleappid", #"X-Authenticaion"="examplesessionkey", #"Content-Type"="application/json"],
Content = Text.ToBinary(formdata)
]
)
in
Source
I have an Azure Custom Connector to a SOAP API that is configured with SOAP to REST. One of the methods have datetime as input:
I am genereting the DateTime with the following expression:
formatDateTime(addDays(utcNow(), -1), 's')
With the following raw input from Logic Apps, I get datetime format exception
{
"method": "post",
"path": "/MethodWithDates",
"retryPolicy": {
"type": "None"
},
"body": {
"MethodWithDates": {
"timefrom": "2019-03-18T15:59:03",
"timeto": "2019-03-19T15:59:03"
}
}
Errormessage from API:
The value '3/18/2019 3:59:03 PM' cannot be parsed as the type 'DateTime'.'
Notice how the datetime format has changed from raw output to recieved in the API. This leads me to believe the custom connector somehow changes the time format.
If I call the same endpoint with SOAP UI with the following SOAP request I get correct response. Notice the Datetime format is same as in RAW input from Logic app:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:MethodWithDates>
<tem:timefrom>2019-03-18T15:13:31</tem:timefrom>
<tem:timeto>2019-03-19T15:13:31</tem:timeto>
</tem:MethodWithDates>
</soapenv:Body>
</soapenv:Envelope>
Interestingly, this seems only to happen for the "s" format specifier, if I format the value in any other way it is passed through in the format I specify. I still get an error in the API as its a WCF API and it seems to require the "s" format.
I can reproduce the same error when SOAP service has a Datetime input which I believe is not parsing correctly.
I am able to make this work by changing the input Datetime fields in Soap Service to string.
Non Working SOAP Service code:
public string GetDaysBetweenDates(DateTime timefrom, DateTime timeto)
{
double value = (timeto - timefrom).TotalDays;
return string.Format("Difference is: {0}", value);
}
Working WSDL Code
public string GetDaysBetweenDates(string timefrom, string timeto)
{
DateTime fromdate = DateTime.Parse(timefrom);
DateTime toDate = DateTime.Parse(timeto);
double value = (fromdate - toDate).TotalDays;
return string.Format("Difference is: {0}", value);
}
u/KetanChawda-MSFT answer is good enough, if you are able to actually change the webservice, but since this was out of our control on this one we had to do something else.
We created a separate SOAP custom connector, just for this one method with SOAP pass through.
The connector has one method, configured like this, with a default WCF API:
Url - http://hostname/Service1.svc/SoapPassThrough
Add two custom headers: Content-Type text/xml and SOAPAction methodname (ours: http://tempuri.org/IService1/methodname where tempuri is namespace
Set body to {} (Empty JSON Object)
In your logic app, you can then create a variable that contain all of the XML for a standard Soap Request. I Used SOAP UI to create a SOAP request and just pasted in the XML from the generated request. This variable can be used as body in the logic app when you consume the service.
This resource can be helpful for this: https://blogs.msdn.microsoft.com/david_burgs_blog/2018/05/03/friendlier-soap-pass-through-with-logic-app-designer-ux/
From what we have concluded, it seems like the custom connector actually sends a string datatype instead of a datetime. Creating the XML request ourself seems to fix this issue.
For example to remove a member from a signing group you call:
/restapi/v2/accounts/1686083/signing_groups/{groupId}/users
and provide:
{
"users": [
{
"userName": "sample string 1",
"email": "sample string 2"
}
]
}
as the body
But my REST object (in ServiceNow) does not allow me to provide a body when I'm using the delete method. Am I just stuck?
I don't think there is any another way to remove the user from a SigningGroup using API. You can try to update the user in a Signing group to a Dummy Email so that original user will not get email for signing. And once in a while DS Admin can go to WEBApp and manually delete it, if Service now is not allowing DS API delete operation with a body.
If you're using RestMessageV2 in ServiceNow scripted Outbound REST, there's a setRequestBody method you can use to set the request body as a string:
Example in the docs here
var sm = new sn_ws.RESTMessageV2("Update user","post");
var body = "{ ...Message body content... }";
sm.setRequestBody(body);
As per the API documentation for Cloudant: Show function can be used to render a document in a different format or extract only some information from a larger document. Same is the case for a list function, the only difference is that it applies on a set of documents. I created a design document with a show function as follows:
{ "shows": { "showDemo":"function(doc,req){return {'body': doc, 'headers':{'Content-Type':'application/json'}}}" } }
When I use this function, _design/showFunc/_show/showDemo/doc1, I get the following error:
{ "error": "unknown_error", "reason": "badarg", "ref": 1793182837 }
I have observed the same error when the show function returns an array. However, no error is given when HTML,Text, XML is returned. Can we say that list/show functions can only return data in a format other than JSON? This example shows the "Accept" header for req object request Object.
What's happening here is that the show function needs to return a response object. From the docs (see http://docs.couchdb.org/en/2.1.0/json-structure.html#response-object) the body field needs to be a string, so you can return whatever you like but it needs to be stringified or otherwise turned into a format that can be sent as HTTP.
If you want to send JSON then doing JSON.Stringify(doc) as the value for body should do what you expect.
If I add parameters to the url in the Objective-C code, is it possible to read it from the client?
Example:
- (NSURL *)serverURL {
return [NSURL URLWithString:#"http://rap.eclipsesource.com/demo?parametername=value"];
}
In the Client-JavaCode I can get the value of the parameter like this:
String parameter = RWT.getRequest().getParameter("parametername");
If I access the "app" with the browser I get a value for the parameter. If I access the app with the TabrisClient the value is null.
Is there a way to get the value also in the TabrisClient?
Update:
The server does not directly extract the query string from the request URL, but from the first JSON message received from the client. The web client provides the parameter queryString in the head part of the first UI request. Example:
{
"head": {
"queryString": "foo=23&bar=42",
"requestCounter": ...
},
"operations": [
...
]
}
You would have to fake this behavior in your Tabris client. I'd suggest that you file an issue against Tabris to provide API to set startup parameters.
Original answer:
If you're going to hard-code the parameter in the tabris client anyway, you could set the variable based on the connected client:
parameter = (RWT.getClient() instanceof WebClient)
? RWT.getRequest.getParameter("parametername")
: "tabris-value";
BTW, access to request parameters is going to change in RAP 3.0. Instead of RWT.getRequest().getParameter(), a ClientService will provide the parameters.