mash:it; API

Endpoints

List fonts by category

Returns a list of categorized fonts from google fonts.

Endpoint

GET /api/v1/font/category/name ?num_results=n&random={1|0}
name type data-type description opt/req
name endpoint name = monospace | sans-serif | serif | handwriting | display returns the full set of fonts from the requested category (required)
num_results parameter n = 1-10 returns the requested number of results in default or randomized order (default= full set of fonts). (optional) when used, parameter random required
random parameter {1|0} returns the requested number of results in default(google font popularity) or randomized order. (optional) when used, parameter num_results required

Example request

curl -i http://www.mashit.nu/api/v1/font/category/monospace

Example response

Status: 200 OK
Content-Type:application/json
[
  {
    "resource_location": "/api/v1/font/category/monospace"
  },
  {
    "font-family": "Inconsolata",
    "variants": [
      "regular",
      "700"
    ],
    "subsets": [
      "latin-ext",
      "latin"
    ],
    "css_import": "@import url(http://fonts.googleapis.com/css?family=Inconsolata:400,700);",
    "link_import": "<link href='http://fonts.googleapis.com/css?family=Inconsolata:400,700' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Source Code Pro",
  "variants": [
    "200",
    "300",
    "regular",
    "500",
    "600",
    "700",
    "900"
  ],
  "subsets": [
    "latin-ext",
    "latin"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Source+Code+Pro:200,300,400,500,600,700,900);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:200,300,400,500,600,700,900' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Droid Sans Mono",
  "variants": [
    "regular"
  ],
  "subsets": [
    "latin"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono:400);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono:400' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Ubuntu Mono",
  "variants": [
    "regular",
    "italic",
    "700",
    "700italic"
  ],
  "subsets": [
    "cyrillic-ext",
    "latin-ext",
    "cyrillic",
    "latin",
    "greek-ext",
    "greek"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400italic,700,700italic);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400italic,700,700italic' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Cousine",
  "variants": [
    "regular",
    "italic",
    "700",
    "700italic"
  ],
  "subsets": [
    "cyrillic-ext",
    "latin-ext",
    "cyrillic",
    "latin",
    "greek-ext",
    "vietnamese",
    "greek"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Cousine:400,400italic,700,700italic);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Cousine:400,400italic,700,700italic' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Anonymous Pro",
  "variants": [
    "regular",
    "italic",
    "700",
    "700italic"
  ],
  "subsets": [
    "latin-ext",
    "cyrillic",
    "latin",
    "greek"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Anonymous+Pro:400,400italic,700,700italic);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Anonymous+Pro:400,400italic,700,700italic' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "PT Mono",
  "variants": [
    "regular"
  ],
  "subsets": [
    "cyrillic-ext",
    "latin-ext",
    "cyrillic",
    "latin"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=PT+Mono:400);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=PT+Mono:400:' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Nova Mono",
  "variants": [
    "regular"
  ],
  "subsets": [
    "latin",
    "greek"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Nova+Mono:400);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Nova+Mono:400' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Cutive Mono",
  "variants": [
    "regular"
  ],
    "subsets": [
    "latin-ext",
    "latin"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Cutive+Mono:400);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Cutive+Mono:400' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Oxygen Mono",
  "variants": [
    "regular"
  ],
  "subsets": [
    "latin-ext",
    "latin"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Oxygen+Mono:400);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Oxygen+Mono:400' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "VT323",
  "variants": [
    "regular"
  ],
  "subsets": [
    "latin"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=VT323:400);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=VT323:400' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Share Tech Mono",
    "variants": [
    "regular"
  ],
  "subsets": [
    "latin"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Share+Tech+Mono:400);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Share+Tech+Mono:400' rel='stylesheet' type='text/css'>"
  },
  {
  "font-family": "Fira Mono",
  "variants": [
    "regular",
    "700"
  ],
  "subsets": [
    "cyrillic-ext",
    "latin-ext",
    "cyrillic",
    "latin",
    "greek"
  ],
  "css_import": "@import url(http://fonts.googleapis.com/css?family=Fira+Mono:400,700);",
  "link_import": "<link href='http://fonts.googleapis.com/css?family=Fira+Mono:400,700' rel='stylesheet' type='text/css'>"
  }
]
      

List palettes by color

Returns a set of palettes created by the COLOURlovers community.

Endpoint

GET /api/v1/palette/color ?num_results=n
name type data-type description opt/req
color endpoint color = [a-fA-F0-9]{6} (hex-code) returns a set of color-palettes based on the requested color. (required)
num_results* parameter n = 1-10 returns the requested number of results (default=6) (optional)

* Mash:it will return a reduced (or empty) set of palettes when less then (or none of) the requested number of palettes are available at the COLOURlovers community.

Example request

curl -i http://www.mashit.nu/api/v1/palette/D7E8D5

Example response

Status: 200 OK
Content-Type:application/json
[
  {
  "resource_location": "/api/v1/palette/D7E8D5"
  },
  {
    "palette": [
      "D7E8D5",
      "E6F0AF",
      "E8ED76",
      "FFCD57",
      "4A3A47"
    ],
    "source_url": "http://www.colourlovers.com/palette/3609015/Indie_Lemon",
    "source_api_url": "http://www.colourlovers.com/api/palette/3609015"
  },
  {
    "palette": [
      "D7E8D5",
      "E6F0AF",
      "E8ED76",
      "FFCD57",
      "4A3A47"
    ],
    "source_url": "http://www.colourlovers.com/palette/3652723/Indie_lemon",
    "source_api_url": "http://www.colourlovers.com/api/palette/3652723"
  },
  {
    "palette": [
      "4A3A47",
      "6A6EBE",
      "957AC7",
      "F0AFDE",
      "D7E8D5"
    ],
    "source_url": "http://www.colourlovers.com/palette/3646993/Purple_exchange",
    "source_api_url": "http://www.colourlovers.com/api/palette/3646993"
  },
  {
    "palette": [
      "D7E8D5",
      "620D10",
      "345E46",
      "85AC91",
      "0B384B"
    ],
    "source_url": "http://www.colourlovers.com/palette/733545/Custom_Westy_Classic",
    "source_api_url": "http://www.colourlovers.com/api/palette/733545"
  },
  {
    "palette": [
      "B028B8",
      "FFFFFF",
      "D7E8D5",
      "B7C2B6",
      "8C968A"
    ],
    "source_url": "http://www.colourlovers.com/palette/1133192/pushup",
    "source_api_url": "http://www.colourlovers.com/api/palette/1133192"
  },
  {
    "palette": [
      "FAE0E9",
      "D7E8D5",
      "FEFEFE",
      "F2DCC5",
      "FCEEE3"
    ],
    "source_url": "http://www.colourlovers.com/palette/106506/Kaira",
    "source_api_url": "http://www.colourlovers.com/api/palette/106506"
  }
]
      

List theme by color and font category

Returns a mix of fonts and palettes

Endpoint

GET /api/v1/theme/color/category ?num_results=n
name type data-type description opt/req
color endpoint hex = [a-fA-F0-9]{6} returns themes with palettes based on the requested color (hex). (required)
category endpoint name = monospace | sans-serif | serif | handwriting | display returns themes with fonts from the requested category (required)
num_results* parameter n = 1-10 returns the requested number of results (default=10) (optional)

* Mash:it will return a reduced (or empty) set of palettes when less then (or none of) the requested number of palettes are available at the COLOURlovers community.

Example request

curl -i http://www.mashit.nu/api/v1/theme/D7E8D5/monospace?num_results=3

Example response

Status: 200 OK
Content-Type:application/json
[
  {
  "resource_location": "/api/v1/theme/D7E8D5/monospace"
  },
  {
    "font": {
      "font-family": "PT Mono",
      "variants": [
        "regular"
      ],
      "subsets": [
        "latin-ext",
        "cyrillic-ext",
        "cyrillic",
        "latin"
      ],
      "css_import": "@import url(http://fonts.googleapis.com/css?family=PT+Mono:400);",
      "link_import": "<link href='http://fonts.googleapis.com/css?family=PT+Mono:400' rel='stylesheet' type='text/css'>"
    },
    "color-palette": {
      "palette": [
        "D7E8D5",
        "E6F0AF",
        "E8ED76",
        "FFCD57",
        "4A3A47"
      ],
      "source_url": "http://www.colourlovers.com/palette/3652723/Indie_lemon",
      "source_api_url": "http://www.colourlovers.com/api/palette/3652723"
    }
  },
  {
    "font": {
    "font-family": "Cutive Mono",
    "variants": [
      "regular"
    ],
    "subsets": [
      "latin-ext",
      "latin"
    ],
    "css_import": "@import url(http://fonts.googleapis.com/css?family=Cutive+Mono:400);",
    "link_import": "<link href='http://fonts.googleapis.com/css?family=Cutive+Mono:400' rel='stylesheet' type='text/css'>"
    },
    "color-palette": {
    "palette": [
      "FAE0E9",
      "D7E8D5",
      "FEFEFE",
      "F2DCC5",
      "FCEEE3"
    ],
    "source_url": "http://www.colourlovers.com/palette/106506/Kaira",
    "source_api_url": "http://www.colourlovers.com/api/palette/106506"
    }
  },
  {
    "font": {
    "font-family": "Inconsolata",
    "variants": [
      "regular",
      "700"
    ],
    "subsets": [
      "latin-ext",
      "latin"
    ],
    "css_import": "@import url(http://fonts.googleapis.com/css?family=Inconsolata:400,700);",
    "link_import": "<link href='http://fonts.googleapis.com/css?family=Inconsolata:400,700' rel='stylesheet' type='text/css'>"
    },
    "color-palette": {
    "palette": [
      "B028B8",
      "FFFFFF",
      "D7E8D5",
      "B7C2B6",
      "8C968A"
    ],
    "source_url": "http://www.colourlovers.com/palette/1133192/pushup",
    "source_api_url": "http://www.colourlovers.com/api/palette/1133192"
    }
  }
]

        

Status codes

Statuscode Message Probably caused by
200 OK -
400 Bad request Invalid parameters, check the documentation
404 Resource not found Not a valid endpoint, check the documentation
500 Internal server error Something went wrong in the application, please contact info@mashit.nu

License

Attribution-Noncommercial-Share Alike - http://creativecommons.org/licenses/by-nc-sa/3.0/