instant PDF

FREE
By yogthos | Updated il y a 16 jours | Data
Popularity

7.8 / 10

Latency

360ms

Service Level

100%

Health Check

N/A

Back to All Discussions

Im trying to post to mashape instant pdf, getting an error

Rapid account: Devopsgdg
devopsgdg
il y a 9 ans

Hi, Im trying to post to mashape instant pdf, code below:

var response = Unirest.post(“https://yogthos.p.mashape.com/”) .header(“X-Mashape-Key”, “DBfzj2fCC3mshBFRrWrFy1Q5xHOUp1v9VuZjsnPCs9SXdtlQDg”) .header(“Content-Type”, “application/x-www-form-urlencoded”) .field(“json-input”, “[{}, [“paragraph”, “” + jsonOrgModel + “”]]”) .asBinary();

Json object below, which is equal to jsonOrgModel:

{“types":"gGivingCommon.Models.OrganizationModel,gGivingCommon,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null":"1","types":{"gGivingCommon.Models.OrganizationModel, gGivingCommon, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null":"1"},"type”:“1”,“accounting_period”:null,“activity_code_1”:null,“activity_code_2”:null,“activity_code_3”:null,“address”:null,“advanced_ruling_expiration_date”:"",“affiliation_code”:"",“asset_amount”:"",“asset_code”:"",“blank”:"",“city”:“Houston”,“classification_code_1”:"",“classification_code_2”:“0”,“classification_code_3”:“0”,“classification_code_4”:“0”,“counter”:null,“country”:null,“created_at”:“4/27/2015 12:40:35 AM”,“deductibility_code”:"",“ein”:“7-41148915”,“exempt_organization_status_code”:"",“exempt_organization_status_code_revoked”:"",“filing_requirement_code_990PF”:"",“filing_requirement_code_990_or_990EZ”:"",“form_990_revenue_amount”:"",“found_in_pub_78”:"",“foundation_code”:"",“group_exemption_number”:"",“id”:“3d93caef-25fd-46d0-979e-159939524dfd”,“in_care_of_name”:"",“income_amount”:"",“income_code”:"",“name”:“Big Brothers Big Sisters of North Texas”,“name_bmf”:“Big Brothers Big Sisters of North Texas”,“name_pub”:null,“ntee_code”:"",“organization_code”:"",“position”:null,“pub_78_status”:null,“ruling_date”:"",“sort_or_secondary_name”:null,“state”:“Tx”,“subsection_code”:"",“tax_period”:"",“tmp_found_in_pub_78”:"",“updated_at”:"",“zip_code”:null}

Looks like im getting a 500 error when debugging, the API error is below:

An error has occurred. The ‘ObjectContent`1’ type failed to serialize the response body for content type ‘application/json; charset=utf-8’. System.InvalidOperationException An error has occurred. Error getting value from ‘WriteTimeout’ on ‘System.Net.Http.StreamContent+ReadOnlyStream’. Newtonsoft.Json.JsonSerializationException at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value) at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding) at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding) at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content) at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken) — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at System.Web.Http.Tracing.ITraceWriterExtensions.d24.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at System.Web.Http.WebHost.HttpControllerHandler.d1b.MoveNext() An error has occurred. The stream does not support writing. System.NotSupportedException at System.Net.Http.StreamContent.ReadOnlyStream.get_WriteTimeout() at GetWriteTimeout(Object ) at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)

Thanks in advance for your help.

Regards,

Patrick Rosenberg

Rapid account: Yogthos
yogthos Commented il y a 9 ans

The API expects a specific format for the JSON document that’s described in the docs here https://github.com/yogthos/instant-pdf it’s not possible to send arbitrary JSON objects to generate a PDF document.

Join in the discussion - add comment below:

Login / Signup to post new comments