Using the getmetadatatext JSON service
getmetadatatext returns metadata from a chunk of plaintext.
getmetadata is invoked by sending a POST request to http://service.metaglance.com/api/json/getmetadatatext with your key encoded in the URL. This POST-only HTTP JSON web service then analyzes your text and returns metadata. (See Metadata Overview and Metadata Details)
Parameters
The payload may be of content type text/plain and avoid most of the complex form information, as shown in the examples. Otherwise you must construct a valid multi-part form data request, with the submitted plaintext block as the first part in the multi-part form. The text can be URL encoded, but does not have to be.
One value is required by getmetadata: key. There is an optional second parameter: identifier.
Your key is displayed in the sidebar to the right. If you don't see it then log-in and create a key, or sign up for a free account.
The identifier value is the identifier of the resource for which metadata is being generated and should be a string. If it is omitted, it will default to the path. If it is included, it will be returned verbatim by the service.
Example POST Request
Content-Type=multipart/form-data; boundary=--7d021a37605f0
----7d021a37605f0
Content-Disposition: form-data;name=DoesNotMatter;filename=DoesNotMatter;
Content-Type: text/plain
text=This is the text that we would like to generate metadata on. The more text, the better.
Examples
Below is a basic text/plain input form. Be sure to replace <yourkey> with the value of your key.
<FORM action="http://service.metaglance.com/api/json/getmetadatatext?key=<yourkey>"
method="post" enctype="text/plain" target="_blank">
<TEXTAREA name="text" cols="75" rows="10"></TEXTAREA><br />
<INPUT type="SUBMIT">
</FORM>
The web service returns a JSON object, like the one below.
{
"averagewordlength": "8.0",
"format": "Text file",
"language": "en",
"medianwordlength": "8.0",
"mediatype": "Text",
"mimetype": "text/plain",
"readinglevel": "3.6897058823529427",
"readingtime": "45.0",
"sentencecount": "2",
"subject": "generate metadata",
"syllablecount": "23",
"title": "The more text the better.",
"uniquewordcount": "15",
"wordcount": "17"
}
