Using the Medium.com API with JSON-AI

Ron Itelman
2 min readNov 2, 2018

A node server should be able to get the title of this document, and this first paragraph of text from this Medium article using Medium.com’s api. This node server then needs to put the information from Medium.com’s api into this exact JSON-AI format.

{
“@i.document": {
"medium": {
"url":"https://medium.com/p/8f44217e6c08",
"body": {
"title": "Using the Medium.com API with JSON-AI",
"content": [
{
"paragraph": "A node server should be able to get the title of this document, and this first paragraph of text from this Medium article using Medium.com's api. This node server then needs to put the information from Medium.com's api into this exact JSON-AI format."
}
}
}
}

STEP 1:

Let’s create a node server that can connect to Medium.com

In my example I will be using the Express application generator, which can be found below.

In your terminal:

You are going to use the express generator to install a node server called medium.
$ cd express install medium
$ cd medium

You should see the following message upon successful install:

install dependencies:
$ cd install && npm install
run the app:
$ DEBUG=install:* npm start
Go ahead an go into the install directory an install the package.json files.$ cd install
$ npm install
In my bin/www.js file I change my port to 1235, so that it doesn't interfere with other services.var port = normalizePort(process.env.PORT || '1235');
In JSON.AI the @i.agent.Medium.req.port = "1235"!

--

--

Ron Itelman
Ron Itelman

Written by Ron Itelman

I like human + machine learning systems | Principal — Digital, Data & Analytics at Clarkston Consulting

No responses yet