Uploading big samples for analysis giving unexpected response - sophoslabs-intelix

While doing the 'POST' request to 'https://de.api.labs.sophos.com/analysis/file/static/v1', I am getting 'HTTP content length exceeded 10485760 bytes.' response.
I know there is a limit to file size we can upload, but earlier we used to get '{message: 'Request Too Long'}' for bigger files(e.g. b28e99d046ac108830a3f5cf0f8eb485b7ce1abafe4d516fba5b4c71cec57fed), which is easier to parse because of JSON.
I am trying to upload sample with sha256 'e102238100a8b97d22559065e3b19379757aeda932c36916d2c84a4178921854'.
Request-
curl -X POST \
https://de.api.labs.sophos.com/analysis/file/static/v1 \
-H 'Authorization: <redacted>' \
-H 'content-type: multipart/form-data' \
-F file=#/tmp/e102238100a8b97d22559065e3b19379757aeda932c36916d2c84a4178921854
So, is there any standard response we will get while uploading big sample size?

The best practice would be to check the response's status code before parsing the response body, so in your case, running curl with the -i or -v option would expose this information to you.
Due to infrastructural limitations, submitting an oversized file up to ~6MB results in a HTTP 413 response, and above that, you can get error messages like 'Remote end closed connection without response' or 'Broken pipe', without a status code.
While the file size restriction may be subject to change in the future, currently there are no plans to change this behaviour.

Related

Sonos Cloud API HTTP POST always returns 500

I'm trying to control my Sonos One (Gen 1) speaker through cloud APIs but all the POST request return 500 Internal Server Error without error message.
I generated an access_token as described in the documentation and was able to obtain information about the 'households' inside my network, finally both the group id and the player id.
I tried to obtain information about the status of the group by performing a GET on the following endpoint and it worked:
https://api.ws.sonos.com/control/api/v1/groups/{{group_id}}/playback
Same with other GET requestes (e.g. groupVolume).
The problem arise when I try to make a POST (e.g. changing the volume or playing an audioClip), it returns 500 Internal Server Error without any body.
For all the requests I am using Postman including as Headers:
Content-Type: application/json
Authorization: Bearer [token]
Content-Length: ??? (automatically inserted by postman)
while for the body of the change volume request I select the raw option and then select JSON(application/json) option.
The body is:
{
"volume": 80
}
The endpoint is the following: https://api.ws.sonos.com/control/api/v1/groups/{{group_id}}/groupVolume
I also tried controlling the player with node (Package) and it works.
Also tried to use Wireshark to see what requests the node-sonos package is performing but it seems it's not using the Cloud APIs.
I expect the player to change volume, but the API doesn't do anything and doesn't return any error message.
EDIT:
The cURL request from POSTMAN is the following:
curl -X POST \
https://api.ws.sonos.com/control/api/v1/players/<playerID>/audioClip \
-H 'authorization: Bearer XXX' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: XXX' \
-d '{
"appId": "edu.myInstitute.myName",
"clipType": "CUSTOM",
"name": "Test",
"streamUrl": "http://...mp3_file_url"
}'

"The revision must be specified." error with status 400 Bad Request when delete controller-services and connections

I try export and import nifi templates via nifi rest api; but when i tried to delete controller-services, connections or import a template i get the response message "The revision must be specified." with '400 bad request' status from nifi rest api. I didn't understand what i have to do.
This my request for delete a control-service,
request "/controller-services/{id}" (id is, The controller service id.)
curl -X DELETE \
http://localhost:8090/nifi-api/controller-services/015b1030-a099-13d3-812c-77772afcaeb0 \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
and the response is "The revision must be specified."
status : "400 Bad Request"
Any idea please?
I finally got some answers about my mistake after reading this article
It seems you have to add two information to request url; version and clientId.
After make a call and get a component form nifi instance, it sends a version number inside a DTO to you as explained here
like this:
and finally i made a call like below and it worked:
curl -X DELETE \
'http://localhost:8090/nifi-api/controller-services/015b1030-a099-13d3-812c-77772afcaeb0?version=0&clientId=5ed15669-015d-1000-99cf-bc9c6f378085' \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \

Trigger Rundeck Job via API

Rundeck supports triggering jobs via their API. The API documentation is available under documentation.
We are using API version 13 which does not yet support application/json. Therefore i need to use the XML based request.
In my previous attempts, i always get the response:
<result error="true" apiversion="13">
<error code="api.error.job.options-invalid">
<message>Job options were not valid: Option 'container' is required. Option 'version' is required.
</message>
</error>
</result>
Since there is no example request provided, i am searching for an example payload to trigger the job.
As seen in the response i have to provide the parameters "container" and "version" since they are required.
My most recent request payload was:
<executeJob>
<argString>-container containerName -version 1234567</argString>
</executeJob>
I also tried different variations of this payload, every time with the same response.
This should help you, assuming you have a token to access Rundeck with authorization to run the job
curl -D - -X "POST" -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Rundeck-Auth-Token: <TOKEN>" \
-d '{"argString":"-arg1 val1 -arg2 val2"}' \
http://<URL>/api/16/job/<JOB_ID>/executions

curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' url:8080/auth/v1.0 results in "HTTP/1.1 400 Bad Request"

I have tried to setup SAIO - Swift All In One as per instructions in "http://docs.openstack.org/developer/swift/development_saio.html"
But when I execute "curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' url:8080/auth/v1.0", it results in "HTTP/1.1 400 Bad Request".
I am new to Cloud Computing and hence any help in this matter is appreciated.
I encountered a similar problem. My code "worked on my system", but when I tried to run my code against a Swift store hosted by Cleversafe, I got the same 400 error.
I solved the problem by using X-Auth-User and X-Auth-Key as the header names rather than X-Storage-User and X-Storage-Pass. Unfortunately, the Swift documentation is net very clear as to the distinction, if any, between these two options.

PayPal Invoicing API error ID 580001

The example call in the PayPal Invoicing API documentation is returning an error?
Request
curl -s --insecure -H "X-PAYPAL-SECURITY-USERID: caller_1312486258_biz_api1.gmail.com" -H "X-PAYPAL-SECURITY-PASSWORD: 1312486294" -H "X-PAYPAL-SECURITY-SIGNATURE: AbtI7HV1xB428VygBUcIhARzxch4AL65.T18CTeylixNNxDZUu0iO87e" -H "X-PAYPAL-REQUEST-DATA-FORMAT: JSON" -H "X-PAYPAL-RESPONSE-DATA-FORMAT: JSON" -H "X-PAYPAL-APPLICATION-ID:APP-80W284485P519543T" https://svcs.sandbox.paypal.com/Invoice/CreateAndSendInvoice -d {\"requestEnvelope\":{\"errorLanguage\":\"en_US\"},\"invoice\":{\"merchantEmail\":\"caller_1335455804_biz#x.com\",\"payerEmail\":\"sender_1335455648_per#x.com\",\"currencyCode\":\"USD\",\"paymentTerms\":\"DueOnReceipt\",\"itemList\":{\"item\":[{\"name\":\"BananaPlant\",\"quantity\":\"1\",\"unitPrice\":\"38.95\"},{\"name\":\"PeachTree\",\"quantity\":\"2\",\"unitPrice\":\"14.95\"}]}}}
Response
{"responseEnvelope":{"timestamp":"2013-08-22T23:58:47.340-07:00","ack":"Failure","correlationId":"4838886d6636b","build":"7236486"},"error":[{"errorId":"580001","domain":"PLATFORM","subdomain":"Application","severity":"Error","category":"Application","message":"Invalid request: {0}"}]}
Try wrapping the payload in the -d switch within "". Running the curl snippet with the -v switch as-is will show you that the payload gets truncated and hence the "Invalid request" error.
Also, you will see a "Invalid token" error when the merchantEmail in the request is not the same as the API caller. If you need to generate invoices on behalf of a third party (in which case the API caller and merchantEmail are naturally different), you must obtain third party permissions and attach a X-PAYPAL-AUTHORIZATION header to your request.