why does quickbooks.api.intuit.com/v3/company/<realm>/upload?minorversion=45 returns: "Maximum line length limit exceeded" - quickbooks

we are sending the following multipart request:
--BYhJbicYjpSMGwjH
Content-Type: image/jpeg
Content-Disposition: form-data; name="file_content_01"; filename="8.thumbnail.jpg"
<base_64_file>
--BYhJbicYjpSMGwjH--
to
quickbooks.api.intuit.com/v3/company/<realm>/upload?minorversion=45
but we are getting back:
{
'Fault': {
'Error': [{
'Message': 'An application error has occurred while processing your request',
'Detail': 'System Failure Error: Maximum line length limit exceeded', 'code': '10000'
}],
'type': 'SystemFault'
},
'time': '2020-03-11T04:13:44.324-07:00'
}

adding a new line before the <base_64_file> solved the issue.

Related

Kinesis Firehose HTTP_Endpoint destination Response format

What is the right format of the Response for Kinesis Firehose with http_endpoint as destination. Have already gone through the aws link:
https://docs.aws.amazon.com/firehose/latest/dev/httpdeliveryrequestresponse.html#responseformat
I have used the below lambda code in python(integrated in api) as well as with many other options, but keep getting the below error message. The test is performed using the "Test with Demo Data" option
sample code:
def lambda_handler(event, context):
data ={}
headersD = {}
headersD['content-length'] = 0
headersD['content-type'] = 'application/json'
data['requestId'] = 'ed4acda5-034f-9f42-bba1-f29aea6d7d8f'
data['timestamp'] = '1578090903599'
bodyDetail= {}
data['body'] = ''
data['headers'] =headersD
data['statusCode']=200
resp = json.dumps(data)
return resp
error response as seen in the logs:
The response received from the endpoint is invalid. See Troubleshooting HTTP Endpoints in the Firehose documentation for more information. Reason:. Response for request 'request-Id' is not recognized as valid JSON or has unexpected fields. Raw response received: 200 "HttpEndpoint.InvalidResponseFromDestination"
Here is the sample output that worked(in python):
responseBody = {
"requestId": "requestId",
"timestamp": 123456
}
resp = {
"headers": {"Content-Type": "application/json", "Content-Length": 100},
"body": json.dumps(responseBody),
"statusCode": 200
}
return resp

Reddit API Add Friend Endpoint /api/friend

Whenever I attempt to make a PUT Request to Reddit API in order to add a friend, it fails and claims a JSON Parse Error 'JSON_PARSE_ERROR'. Nothing I do is working. Here is how I form the request.
Endpoint: /api/v1/me/friends/username
>>> Endpoint URL: PUT https://oauth.reddit.com/api/v1/me/friends/micheal
Authorization: Bearer <Access_Token>
// The response given:
{"fields": ["json"], "explanation": "unable to parse JSON data", "reason": "JSON_PARSE_ERROR"}
I have also tried the /api/friend/username endpoint and nothing works.
I had exactly the same problem, and your question led me to the solution.
The endpoint is expecting a json payload ACTUALLY NAMED "json." I'm not sure what language you're using, this is what it looks like in Node:
var options = {
url: 'https://oauth.reddit.com/api/v1/me/friends/mynewfriend',
headers: {
'User-Agent': 'Appname/1.0 by username',
'Authorization': "bearer " + <Access_Token>
},
json: {
'name': 'mynewfriend',
'notes': 'whatever notes you want to put',
}
};
request.put(options, function(error, response, body) {
blah blah blah
}
the json itself is described in https://www.reddit.com/dev/api/#PUT_api_v1_me_friends_{username}

Swift / iOS: Error to post image to Pinterest

Im getting this error while posting image to Pinterest
Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: unauthorized (401)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x144603bd0> { URL: https://api.pinterest.com/v1/pins/ } { status code: 401, headers {
"Accept-Ranges" = bytes;
"Cache-Control" = private;
Connection = close;
"Content-Length" = 177;
"Content-Type" = "application/json";
Date = "Sun, 10 Jul 2016 19:38:00 GMT";
"Pinterest-Generated-By" = "devplatform-devapi-prod-de3d740a";
"Pinterest-Version" = bcdafd3;
Server = nginx;
"X-Content-Type-Options" = nosniff;
"X-Pinterest-RID" = 480720869025;
"X-Varnish" = 2958547338;
} }, NSErrorFailingURLKey=https://api.pinterest.com/v1/pins/, com.alamofire.serialization.response.error.data=<7b227374 61747573 223a2022 6661696c 75726522 2c202263 6f646522 3a20332c 2022686f 7374223a 20226465 76706c61 74666f72 6d2d6465 76617069 2d70726f 642d6465 33643734 3061222c 20226765 6e657261 7465645f 6174223a 20225375 6e2c2031 30204a75 6c203230 31362031 393a3338 3a303020 2b303030 30222c20 226d6573 73616765 223a2022 41757468 6f72697a 6174696f 6e206661 696c6564 2e222c20 22646174 61223a20 6e756c6c 7d>, NSLocalizedDescription=Request failed: unauthorized (401)}
Here is my code:
PDKClient.sharedInstance().createPinWithImage(image, link: NSURL(string:"http://domain"), onBoard: "MyBoard", description: caption, progress: {percent in
print(percent)
}, withSuccess: {PDKResponseObject in
print("ok")
print(PDKResponseObject.boards())
}, andFailure: {error in
print(error)
})
Error 401 means one of the following.
1.Authentication failed.
2.Authorization failed.
3.You are not permitted to access that resource.
Double check your permissions, check your session token expired or not.
So I think that there is nothing wrong with your code, or the request. It's something with the permissions you have in your Pinterest app.
Try changing the request URL from http to https.
Check the parameters you sending to Pinterest, check whether the parameter names are correct or not, as specified in Pinterest documentation. Also those parameters has the proper type of data, I mean do not pass String in the place of Integer value.
.

AFNetworking Serialization Response Error

I'm using AFNetworking version 3.0 for handling a POST request.
When I run the code I get an error that says:enter code here
2016-01-26 16:48:50.181 Voluntree[3590:1749083] In order to validate a domain name for self signed certificates, you MUST use pinning.
2016-01-26 16:48:50.905 Voluntree[3590:1748745] Error: Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/plain" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x13deb83d0> { URL: https://voluntree.imrapid.io/signup_by_email } { status code: 200, headers {
"Access-Control-Allow-Headers" = "Origin, X-Requested-With, Content-Type, Accept";
"Access-Control-Allow-Methods" = "POST, GET, OPTIONS, PUT, DELETE, HEAD";
"Access-Control-Allow-Origin" = "*";
Connection = "keep-alive";
"Content-Length" = 4;
"Content-Type" = "text/plain";
Date = "Tue, 26 Jan 2016 14:48:50 GMT";
Server = Cowboy;
Via = "1.1 vegur";
"X-Powered-By" = Express;
} }, NSErrorFailingURLKey=https://voluntree.imrapid.io/signup_by_email, com.alamofire.serialization.response.error.data=<32343634>, NSLocalizedDescription=Request failed: unacceptable content-type: text/plain}
You should change the header "Content-Type" value to application/www-x-form-urlencoded and not "text/plain" as it right now.
For application/x-www-form-urlencoded, the body of the HTTP message sent to the server is essentially one giant query string -- name/value pairs are separated by the ampersand (&), and names are separated from values by the equals symbol (=). An example of this would be:
MyVariableOne=ValueOne&MyVariableTwo=ValueTwo

RestKit - Expected Content Type application/json

I am experiencing the weirdest error while using RestKit. Here's the localized description of the error -
Expected content type {(
"application/json",
"text/html",
"text/plain",
"application/x-www-form-urlencoded"
)}, got {application/json}
As you can see, I am expecting "application/json" as a content type, and the server is returning application/json. I have no idea why I am getting this error!
The detailed error is here --
2015-02-19 11:24:43.234 MyProject[62944:10754151] E restkit.network:RKObjectRequestOperation.m:213 POST 'https://ipaddress/api/v1.0/user/verify' (200 OK / 0 objects) [request=0.1408s mapping=0.0000s total=0.1428s]: Error Domain=org.restkit.RestKit.ErrorDomain Code=-1016 "Expected content type {(
"application/json",
"text/html",
"text/plain",
"application/x-www-form-urlencoded"
)}, got {application/json" UserInfo=0x7f9c49db4930 {NSLocalizedRecoverySuggestion={"user_id":"3749f17f647c4ee1a9ee9d75c5f49f7e","domain":"domain","device_id":"2751029764","access_token":"589134b447974320b2d494a491e8226a","access_token_expiration":2181237828314,"refresh_token":"cb06c038be7b4f7c930de1fcb3f2017a"}, NSErrorFailingURLKey=https://ipaddress/api/v1.0/user/verify, AFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest: 0x7f9c49def0c0> { URL: https://ipaddress/api/v1.0/user/verify }, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x7f9c49f567a0> { URL: https://ipaddress/api/v1.0/user/verify } { status code: 200, headers {
"Baseline-Request-Id" = 30f91b50;
Connection = "keep-alive";
"Content-Length" = 230;
"Content-Type" = "{application/json, q=1000}";
Date = "Thu, 19 Feb 2015 19:23:48 GMT";
Server = "nginx/1.6.2";
} }, NSLocalizedDescription=Expected content type {(
"application/json",
"text/html",
"text/plain",
"application/x-www-form-urlencoded"
)}, got {application/json}
Update --
After some debugging, I found out that the problem lies in the value of "Content-Type" I am getting in the response. As you can see in the example above, the value is "{application/json, q=1000}" instead of "application/json". RestKit, for some reason, is reading it as "{application/json" (omitting the stuff after the comma, and notice the starting brace) and hence not finding a match with the expected types.
To "solve" it in a dirty way, I added the following line (notice the "{" before "application/json")
[RKMIMETypeSerialization registerClass:[RKNSJSONSerialization class] forMIMEType:#"{application/json"];
But we all know its not the right way. I don't know what is wrong here, is the server sending something incorrect? Or is RestKit supposed to read it differently?
I couldn't find the reason why the server was returning a "Wrong" content type. The developers of the server denied that it was doing something wrong. So I ended up using my dirty hack and added a "{" before "application/json".
[RKMIMETypeSerialization registerClass:[RKNSJSONSerialization class] forMIMEType:#"{application/json"];

Resources