Content-Type for Email Markup Actions - email

I've been looking at email Actions (which apparently are in a process of being standardized), and considering implementing these for an application of mine.
However, the entire documentation seems to be missing the mime-type to define for the message part that includes this json-ld metadata. For example, gpg signatures are marked as
Content-Type: application/pgp-signature; name="signature.asc"
What Content-Type does this part (eg: this content) need to be included as?

You have to include it in the email’s HTML (text/html).
Google (i.e., Gmail and Inbox by Gmail) supports JSON-LD and Microdata:
The JSON-LD will be included in a script element (used as data block).
The Microdata attributes (like itemscope and itemprop) will be added directly to the (existing) HTML elements.
So, if your email would contain this HTML
<html>
<body>
<p>Foobar</p>
</body>
</html>
you could add JSON-LD to it like this
<html>
<body>
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Thing",
"name": "Foobar"
}
</script>
<p>Hello!</p>
</body>
</html>
and Microdata like this
<html>
<body itemscope itemtype="http://schema.org/Thing">
<p itemprop="name">Foobar</p>
</body>
</html>

Related

Tinymce wraps output in <html> tags instead of <p> tags

Tinymce wraps output as a full html page instead of wrapping it in paragraph or div tags as html snippets. The code below shows an output stored to database
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Which of the numbers from the options is a prime number</p>
</body>
</html>
You likely have the fullpage plugin loaded - if you don't load that plugin TinyMCE will only allow you to work with the content inside the <body> and it will only provide the data inside the <body> when you submit the form or ask for the content via an API call.

Any way to get the tag on a note (not just a page element) via OneNote REST API?

OneNote tags on page elements (e.g. <p>) show up in the HTML content returned via the REST API prefixed with a data-tag=attribute. But if the complete note is tagged, that tag doesn't seem to show up in the returned content.
Or am I missing something?
[EDIT]
Here's a screenshot showing the complete note tagged as 'Important' (star symbol) :
I can't see anything in the returned content that relates to that tag:
<html lang="en-US">
<head>
<title>Didi Chuxing = Jean Liu</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body data-absolute-enabled="true" style="font-family:Calibri;font-size:11pt">
<div style="position:absolute;left:48px;top:67px;width:576px">
<img width="480" height="270" src="https://www.onenote.com/api/v1.0/me/notes/[...]
<br />
<p lang="en-NZ" style="font-size:14pt;margin-top:0pt;margin-bottom:0pt">credit : Fast Company</p>
</div>
</body>
</html>
[EDIT]
This question has led to a UserVoice request for this feature to be added in to the API. Only one vote so far - maybe this mention will get it more ;)
The note-tag you are showing is in the title of the page.
Currently, the OneNote API does not support returning note tags in the title. This is different to note-tags in the body, because the title tag is returned in our API as part of the HTML->head->title - other note-tags are returned within the HTML->body. I believe the right way of representing this information is to add the data-tag attribute to the HTML->head->title element.
I suggest creating a UserVoice item for this feature.
https://onenote.uservoice.com/forums/245490-onenote-developer-apis

anchor tag with href as other than http is not working while sending mail to gmail

I am using the smtp sendmail function, in the anchor <a> tag href attribute we have reference other than http:// ie something like below
transauth://some other data
but the gmail is not creating the hyperlink of transauth but creating of http://gmail.com ,Any solutions regarding this.
Gmail strips links that use custom uri schemas.
A work around however is that if you have a website somewhere you can host a simple redirect page that will redirect you to the correct schema.
This is a pretty bullet proof redirect here I copied from this answer to another question
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1;url=http://example.com">
<script type="text/javascript">
window.location.href = "http://example.com"
</script>
<title>Page Redirection</title>
</head>
<body>
<!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
If you are not redirected automatically, follow the <a href='http://example.com'>link to example</a>
</body>
</html>

Facebook URL Linter incorrectly throwing error on Microdata markup

The Facebook URL Linter now throws errors when it sees tags outside of the head. The problem is that these tags are used for Microdata markup.
So in my HTML, in the body, I'll have tags equivalent to:
<meta itemprop="ratingValue" content="5"/>
It's required to be in the <body> since it needs to be encapsulated within my <DIV> where I'm specifying the necessary itemprop value. ie:
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
...
<meta itemprop="ratingValue" content="5"/>
</div>
The Facebook URL linter never threw errors on this when I first implemented microdata markup but when I did a check on one of our pages today, the error shown was:
Body Meta: You have <meta> tags ouside of your <head>. This is either because your <head> was malformed and they fell lower in the parse tree, or you accidentally put your Open Graph tags in the wrong place. Either way you need to fix it before the tags are usable.
I did a double check on Google's documentation on Microdata and it has a code example that also has a META tag that must be outside the head since it's nested within a <DIV>:
<div itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">
Rating: <span itemprop="value">8.5</span>
<meta itemprop="best" content="10" />
</div>
Anyone else having this problem too?

Specifying parameter in PUT - Rest Web Service

I'm building a REST web service using the Jersey API and I've having a problem passing the parameter to the PUT method. The method is this:
#PUT
#Consumes("text/html")
public void putHtml (String content) {
System.out.println("Content"+content);
}
I'm calling it using the following:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function passName()
{
xmlHttp=new XMLHttpRequest();
var url = "/RestWebApp/resources/greeting";
xmlHttp.open("PUT",url,false);
xmlHttp.send();
}
</script>
<title>REST Testing</title>
</head>
<body>
Put name:<input type="text" name="name"/>
<br />
<input type="button" value="Put" onclick="passName()"/>
</body>
</html>
The PUT method is being called since I'm getting "Content " printed in the server console (which is Glassfish) but the parameter is not being read it seems. Is there an #statement or something which I should add to the parameter?
Thanks!
Krt_Malta
You are not setting the body of the request in your client code.
You need to send some content, e.g.
xmlHttp.Send("here is my content")
However you have declared your receiving endpoint to accept "text/html". I would change that to accept "text/plain" instead. Or if you really want to receive multiple values you could accept "application/x-www-urlencoded-form". However you will need to format that yourself in the javascript. Web browsers don't know how to PUT forms. They can only POST forms.