Challenge Overview
For this challenge we want to build a command line tool (preferably nodeJS) to insert content from a postgreSQL database.table to Contentful.com content type. The tool itself will have two modes: (1) “map create mode” which will take the database connection string (and table) and the Contenful connection string (and Content Type) and will generate a json mapping file ( The user will manually edit the outputted json file to create the actual field relationship mapping. ) and (2) Insertion mode: which takes two parameters, the json mapping file name and the ‘where clause’ of the PostgreSQL query -- in case the user wants a subset of the table to be loaded. You may choose to deliver this as one command line utility with a switch for the modes or you may create two utilities one for each mode.
Requirements:
1. Any modern tooling language is allowed but Node is prefered
2. Your utility may export from the db to a file or you can do it all in memory
3. The result of mode 1 (“map create mode”) should result a json file that includes the schema for both contentful and postgres, with a blank mapping section which will allow the user to add the fields from both systems in a key value pair.
4. Your command line utility(s) should have a help option called with -h --help or help switch.
5. The solution must also work on windows. npm3 would be a good choice to satisfy this requirement.
Optional:
1. An ideal solution will write the primary key from postgres to contentful as well as do a call back to postgres and write the contentful id. The goal here is that both systems will have a foreign key to each other.
2. For now you may assume that the content is flat and has no relationship, however if you choose to address relationships now (child - parent) good things will happen to you.
3. Binary base64 encoding content is not in scope for this challenge however it is need in the future. If you choose to address it now good things will happen to you.
Contentful is a nice content management backend. It has a fairly robust set of apis however the tool behind them are sometime hit or miss. You may choose to build off these existing toolset however we have had mixed results with them, and we know some, (namely the database-exporter.rb ) has some current bugs making it not useable . The creation of content is fairly simple with the REST api by itself and we have great success just make a PUT or POST.
Rate limit:
Contentful has a delivery api for showing data and a management api for creating data. You will be using the contentful management api. This api (unlike the delivery API) has a rate limit of 10 calls per second. For this reason you will need to slow down you script to not viloate this limit or you will receive a connection reset.
Contentful and PostgreSQL schemas
Below you will find the schema for the both Contentful and Postres. Feel free to customize this schema as needed this is only a suggestive representation of the most simple object possible. You will have to load data yourself.
CREATE TABLE content_section
(
title character varying NULL,
displayTitle boolean,
contentText character varying NULL,
externalId character varying NULL,
contentfulId character varying NULL,
);
Example Data
"Homepage",true,"This is our <b>home</b> page!,"qwert",""
"About Us",true,"This is our <b>about us</b> page!,"asdfg",""
"Contact Us",true,"This is our <b>Contact Us</b> page!,"zxcvb",""
Contentful Model (You will have to build this manually in Contentful)
Section Title (Short Text)
Display Title (Boolean)
Section Text (Long Text)
External Id (Short Text)
2. Provide a detailed document of your solution including installation, dependencies and operation
3. Provide a quick video of you solution in action, if you are not comfortable with spoken english feel free to annotate your video with text.
Requirements:
1. Any modern tooling language is allowed but Node is prefered
2. Your utility may export from the db to a file or you can do it all in memory
3. The result of mode 1 (“map create mode”) should result a json file that includes the schema for both contentful and postgres, with a blank mapping section which will allow the user to add the fields from both systems in a key value pair.
4. Your command line utility(s) should have a help option called with -h --help or help switch.
5. The solution must also work on windows. npm3 would be a good choice to satisfy this requirement.
Optional:
1. An ideal solution will write the primary key from postgres to contentful as well as do a call back to postgres and write the contentful id. The goal here is that both systems will have a foreign key to each other.
2. For now you may assume that the content is flat and has no relationship, however if you choose to address relationships now (child - parent) good things will happen to you.
3. Binary base64 encoding content is not in scope for this challenge however it is need in the future. If you choose to address it now good things will happen to you.
Contentful is a nice content management backend. It has a fairly robust set of apis however the tool behind them are sometime hit or miss. You may choose to build off these existing toolset however we have had mixed results with them, and we know some, (namely the database-exporter.rb ) has some current bugs making it not useable . The creation of content is fairly simple with the REST api by itself and we have great success just make a PUT or POST.
Rate limit:
Contentful has a delivery api for showing data and a management api for creating data. You will be using the contentful management api. This api (unlike the delivery API) has a rate limit of 10 calls per second. For this reason you will need to slow down you script to not viloate this limit or you will receive a connection reset.
Contentful and PostgreSQL schemas
Below you will find the schema for the both Contentful and Postres. Feel free to customize this schema as needed this is only a suggestive representation of the most simple object possible. You will have to load data yourself.
CREATE TABLE content_section
(
title character varying NULL,
displayTitle boolean,
contentText character varying NULL,
externalId character varying NULL,
contentfulId character varying NULL,
);
Example Data
"Homepage",true,"This is our <b>home</b> page!,"qwert",""
"About Us",true,"This is our <b>about us</b> page!,"asdfg",""
"Contact Us",true,"This is our <b>Contact Us</b> page!,"zxcvb",""
Contentful Model (You will have to build this manually in Contentful)
Section Title (Short Text)
Display Title (Boolean)
Section Text (Long Text)
External Id (Short Text)
Final Submission Guidelines
1. Please submit your solution as a single zip file.2. Provide a detailed document of your solution including installation, dependencies and operation
3. Provide a quick video of you solution in action, if you are not comfortable with spoken english feel free to annotate your video with text.