The Bacon Ipsum JSON API is a REST interface for generating meaty lorem ipsum text and can be used by any application. Pass in the following parameters using an HTTPS GET and we’ll return a JSON string array of paragraphs.
Parameters:
- type: all-meat for meat only or meat-and-filler for meat mixed with miscellaneous ‘lorem ipsum’ filler.
- paras: optional number of paragraphs, defaults to 5.
- sentences: number of sentences (this overrides paragraphs)
- start-with-lorem: optional pass 1 to start the first paragraph with ‘Bacon ipsum dolor sit amet’.
- format: ‘json’ (default), ‘text’, or ‘html’
Examples:
- https://baconipsum.com/api/?type=meat-and-filler
- https://baconipsum.com/api/?type=all-meat¶s=2&start-with-lorem=1
- https://baconipsum.com/api/?type=all-meat&sentences=1&start-with-lorem=1
- https://baconipsum.com/api/?type=meat-and-filler¶s=5&format=text
- https://baconipsum.com/api/?type=all-meat¶s=3&start-with-lorem=1&format=html
Some sample jquery code!
$(document).ready(function() { $("#baconButton").click(function() { $.getJSON('https://baconipsum.com/api/?callback=?', { 'type':'meat-and-filler', 'start-with-lorem':'1', 'paras':'3' }, function(baconGoodness) { if (baconGoodness && baconGoodness.length > 0) { $("#baconIpsumOutput").html(''); for (var i = 0; i < baconGoodness.length; i++) $("#baconIpsumOutput").append('<p>' + baconGoodness[i] + '</p>'); $("#baconIpsumOutput").show(); } }); }); });
Run the sample!
Pingback: 5 Fun Lorem Ipsum Generators | Coffee, Code & Cats
Pingback: Promises vs. Callbacks - troublemaker.xyz
Pingback: Sharing Data Components between React and React Native | Shockoe
Pingback: public example apis: GitHub File Free Download
Pingback: boilerplate.react.spa.full server: GitHub File Free Download
Pingback: 8 Fun, Random, and Useless APIs to Tinker With Today | Nordic APIs |