Por Andrii | Atualizado 3 months ago | Tools
Voltar para todas as discussões

Testing the request gives an API error.

5 years ago

When I try the JSON file conversion request, I get an error from the API: "there was an error during the conversion"
Could you please give me an example of how to send a simple JSON file to the API?

json-xls.com commented 5 years ago

It’s a <code>504 Gateway timeout</code> error.<br/>
Can you send your phrases.json through contact form http://www.json-xls.com/Support ? <br/>
Auditing requests and transactions are managed by Mashape, not by an API provider. Please ask Mashape support for a help.

json-xls.com commented 5 years ago

Your screenshot has YourMashapeKey! You should NOT share it [MashapeKey] with anyone! Please regenerate YourMashapeKey or remove screenshot from comment <br/>
You are trying to upload file, not a raw JSON. Instead of <br/>
<code>POST https://json2xls-json-xls-v1.p.mashape.com/<b>ConvertJsonRaw</b>?format=xls&layout=Auto&view=Both HTTP/1.1</code><br/>
please use<br/>
<code>POST https://json2xls-json-xls-v1.p.mashape.com/<b>ConvertJsonFile</b>?format=xls&layout=Auto&view=Both HTTP/1.1</code><br/>
See second screenshot <br/>

GoranMandic commented 5 years ago

It is a big array, a lot of objects, maybe the conversion just takes a bit longer… I submitted a download link for the file in the form you sent.

json-xls.com commented 5 years ago

You can use Fiddler tool to run HTTP request as it described here http://www.json-xls.com/api
<br />
<code>POST https://json2xls-json-xls-v1.p.mashape.com/ConvertJsonRaw?format=xls&layout=Auto&view=Both HTTP/1.1</code><br />
<code>User-Agent: Fiddler</code><br />
<code>Content-Type: application/json</code><br />
<code>Content-Length: 137</code><br />
<code>Host: json2xls-json-xls-v1.p.mashape.com</code><br />
<code>X-Mashape-Authorization: YOUR_MASHAPE_KEY</code><br />
<code></code><br />
<code>{“employees”:[{“firstName”:“John”, “lastName”:“Doe”},{“firstName”:“Anna”, “lastName”:“Smith”},{“firstName”:“Peter”, “lastName”:“Jones”}]}</code>

GoranMandic commented 5 years ago

Hi, thanks for the help. I am having a request timeout problem now:
I think I got everything right this time, the URL, the key, the headers. Do you have any idea why it’s not working?
Again, I’m sorry to be a bother, I know I’m on the basic plan which does not include support, but I’m really struggling in figuring this out. Also, All of the previous requests I made to the API are being counted even though they are of no use to me since all I’m trying to do is convert one big JSON file using this API. The subscription description says that I have 5 daily requests, but I received an email saying I used up my monthly quota. What’s up with that? I only made around 15 requests, and more than half of those resulted in an error.
Again, thanks for your patience 😃

GoranMandic commented 5 years ago

Thanks for the quick reply. I just tried making a post request using fiddler and I receive a 415-unsupported type response.


HTTP/1.1 415 Unsupported Media Type
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Wed, 19 Oct 2016 22:39:32 GMT
Expires: -1
Pragma: no-cache
Server: Mashape/5.0.6
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-RateLimit-request-Limit: 5
X-RateLimit-request-Remaining: 1
Content-Length: 730
Connection: keep-alive

{“Message”:“The request entity’s media type ‘multipart/form-data’ is not supported for this resource.”,“ExceptionMessage”:“No MediaTypeFormatter is available to read an object of type ‘Object’ from content with media type ‘multipart/form-data’.”,“ExceptionType”:“System.Net.Http.UnsupportedMediaTypeException”,“StackTrace”:" at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"}

I’ve checked my JSON file for validity and minified it, it’s around 7MB. Here’s a screenshot of my request:

Junte-se à discussão - adicione o comentário abaixo:

Efetue login / inscreva-se para postar novos comentários
Avaliação: 5 - Votos: 1