Hi
No matter what I do I get “Invalid file type” back.
I have done exactly as in the examples (node+curl) just changed “/tmp/path.to.font” to a real path (even tried with an invalid one too)
Something must be wrong with my account ? Any ideas ?
아래에 의견을 추가하고 토론에 참여하세요.
Can you try the same file from mashape api doc console and tell us if you see the same error?
I have tried the curl, php and node examples, but mostly tried from node js. Here is my node code:
´´´ var fs = require(‘fs’);
var unirest = require(‘unirest’);
var Request = unirest.post(“https://convertfonts.p.mashape.com/convert”)
.headers({
“X-Mashape-Authorization”: “9or1y0mfk71GiPDY7DIYmSW6aIrYv74b”
})
.send({
“target”: “woff”,
´´´
It works fine from the mashape api doc console.
Error-code is 1001, “invalid file type” when trying from node js
If it works from the api doc console there is no problem with your font file. Can you send us the exact curl command you are executing?
We were able to successfully execute this and get the converted font back using the same font file located here…
http://henning.wapps.dk/henningOLD/bin/services/fonts/myriad.ttf
and using your key posted in the comment.
Most likely your node.js is not able to post the file successfully (permission issues?). Try the following python code and let us know.
BTW I think the issues can be viewed by everyone, which means anyone can see the key. You might want to revoke that key and request a new one from Mashape.
------------python-----------------
import unirest;
response = unirest.post(“https://convertfonts.p.mashape.com/convert”,
headers={
“X-Mashape-Authorization”: “…”
},
params={
“target”: “svg”,
“font”: open("./myriad.ttf", mode=“r”),
“binary”: “true”
}
);
print response.headers;
print response.body;
------------python-----------------
Let us know if we can close this issue.
The formatting of the code is a bit off above. The source-file is here: http://henning.wapps.dk/henningOLD/bin/services/fonts/doConvert.js
The python code worked perfectly and I can just call the python script from my node project.I will revoke the key.
Thanks for your support.