\r\n \r\n\r\n```"],"dateCreated":"2018-06-06","url":"https://rapidapi.com/Textvis/api/word-cloud/discussions/8127/Can","upvoteCount":0,"author":{"@type":"Person","name":"Textvis"}}}}
RapidAPI logo

Sign Up

Log In

Word Cloud

FREEMIUM
By Textvis
Updated 3 months ago
5.8/10
Popularity Score
733ms
Latency
49%
Success Rate
imdave4mea year ago
Can't get usable PNGPlease advise, the following doesn't produce a valid PNG file. I tried removing the headers, but it still didn't work. Thanks! curl -X POST --include 'https://textvis-word-cloud-v1.p.mashape.com/v1/textToCloud' -H 'X-Mashape-Key: <private>' -H 'Content-Type: application/json' -H 'Accept: text/plain' --data-binary '{"text":"This is a test. I repeat, this is a test. We are only testing the functionality of this api, nothing else. End of test.","scale":0.5,"width":800,"height":800,"colors":["#375E97","#FB6542","#FFBB00","#3F681C"],"font":"Tahoma","use_stopwords":true,"language":"en"}' -o "image.png" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16369 100 16098 100 271 18332 308 --:--:-- --:--:-- --:--:-- 19210 [email protected]:~$ file image.png image.png: ASCII text, with very long lines, with CRLF line terminators
Textvisa year ago
Sure! You would have to use javascript to do this. Below is an example. You have to put in your mashape key instead of the text "ENTER YOUR MASHAPE KEY HERE" for it to work. ``` <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>title</title> </head> <body> <img id="wordcloud" /> <script type="text/javascript"> var xhttp = new XMLHttpRequest(); xhttp.open("POST", "https://textvis-word-cloud-v1.p.mashape.com/v1/textToCloud", true); xhttp.setRequestHeader("X-Mashape-Key", "ENTER YOUR MASHAPE KEY HERE") xhttp.setRequestHeader("Content-type", "application/json"); xhttp.setRequestHeader("Accept", "text/plain"); xhttp.onreadystatechange = function() { if(this.readyState == 4 && this.status == 200) { document.getElementById("wordcloud").src = this.responseText; } } xhttp.send('{"text":"This is a test. I repeat, this is a test. We are only testing the functionality of this api, nothing else. End of test.","scale":0.5,"width":800,"height":800,"colors":["#375E97","#FB6542","#FFBB00","#3F681C"],"font":"Tahoma","use_stopwords":true,"language":"en"}'); </script> </body> </html> ```
imdave4mea year ago
Oh cool, could you show me how to call the above using HTML?
Textvisa year ago
Hi! The response is base64 encoded and has to be converted to png to be used as a png-file. However, it works fine to add it do the "src"-attribute of an img-tag on a website. If you tell me more about your use case I can probably point you in the right direction as to how to best fix it.
Hi Developer, feel free to post your answer:
Log inSign up

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://textvis-word-cloud-v1.p.rapidapi.com/v1/textToCloud?max_words=200&font=Tahoma&language=en&colors=%5B'%23375E97'%2C+'%23FB6542'%2C+'%23FFBB00'%2C+'%233F681C'%5D&use_stopwords=true&scaling=0.5&width=800&height=800&text=This+is+a+test.+I+repeat%2C+this+is+a+test.+We+are+only+testing+the+functionality+of+this+api%2C+nothing+else.+End+of+test.")
.header("X-RapidAPI-Host", "textvis-word-cloud-v1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("x-api-key", "qLn10OtYwY8MILjfYAIH11rx6yVWaGMOUNh0NZQh")
.header("Content-Type", "application/json")
.send("text=Hello")
.send({"text":"This is a test. I repeat, this is a test. We are only testing the functionality of this api, nothing else. End of test.","scale":0.5,"width":800,"height":800,"colors":["#375E97","#FB6542","#FFBB00","#3F681C"],"font":"Tahoma","use_stopwords":true,"language":"en","uppercase":false})
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication