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" - openstack-swift

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.

Related

Uploading big samples for analysis giving unexpected response

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.

Wildfly, restart server group

I need to restart a server group, using the HTTP API. I can't figure out what the correct syntax is.
I tried a lot of
HashMap<String, Object> requestMap = new HashMap<>();
requestMap.put("operation", "something-something");
requestMap.put("address", "something-something");
final Response response = managementContext
.request()
.header("X-Requested-By", WildflyUtils.class.getName())
.post(Entity.json(requestMap));
or "by hand":
{"operation":"something-something", "address":"something-something", "json.pretty":1}
I'm guessing around. Does someone know which command is best and what the correct syntax for the address is, or where a useful documentation for the HTTP API is? The official documentation (https://docs.jboss.org/author/display/WFLY10/The+HTTP+management+API) is somewhat small.
I do not know whether it help but I tried with the curl:
curl --digest -u "username:password" 'http://localhost:9990/management' --header "Content-Type: application/json" -d '{"operation":"restart-servers","address":[{"server-group":"your_server_group"}]}'
for standalone:
curl --digest -u "username:password" 'http://localhost:9990/management' --header "Content-Type: application/json" -d '{"operation":"reload","address":[]}'
You should take a look at WildFly 11.0 Model Reference, but I am afraid this does not cover the domain mode.
I had a small demo code here. In your case you should do:
requestMap.put("address", "[\"server-group",\"myServerGroup\"]");
requestMap.put("operation", "restart-servers");
requestMap.put("blocking", "true/false");
requestMap.put("start-mode", "normal/suspend");

kaa update configuration using REST API

I used kaa rest api for changing my configuration as follow:
curl -v -S -u devuser:devuser123 -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"applicationId": "2",
"schemaId": "65539",
"endpointGroupId": "32768",
"body": "{\"timeConfig\":{\"org.kaaproject.configuration.unchangedT\":\"unchanged\"},\"dailySchedules\":{\"org.kaaproject.configuration.unchangedT\":\"unchanged\"},\"enabled\":{\"boolean":false},\"relays\":{\"array\":[false,false,false,true,true,false,false,false]},\"samplePeriod\":{\"int\":9}}",
}' 'http://localhost:8080/kaaAdmin/rest/api/configuration' | python -mjson.tool
But I get HTTP/1.1 400 Bad Request. Does my post parameters seems OK? any suggestion will be appreciated.
Finally I found the problem. Kaa Rest API Works perfect. It was about mismatching schemaID and endpointgroupId. I got the correct values from kaa web interface:
http://localhost:8080/kaaAdmin/#config:appId=2&endGroupId=32768&create=false&active=true&random=0.19035219790078206&schemaId=65539
. since the 400 ERROR CODE is not present in Rest documentation, I had no clue that where was the problem.

Orion context broker - Bad Input JSON Parse Error on quite long attribute value

Are there any known limitations on the length of values of an attribute or a metadata value?
On setting a quite long string (>30-40k chars) at attribute value I am receiving a
WARNING#13:45:37 jsonRequest.cpp[225]: Bad Input (JSON Parse Error)
DEBUG#13:45:37 UpdateContextResponse.cpp[60]: destroyed
DEBUG#13:45:37 UpdateContextResponse.cpp[74]: destroyed
WARNING#13:45:37 jsonRequest.cpp[233]: Bad Input (JSON Parse Error: <unspecified file>(1): expected end of input)
DEBUG#13:45:37 RestService.cpp[126]: result: '{
"errorCode" : {
"code" : "400",
"reasonPhrase" : "Bad Request",
"details" : "JSON Parse Error"
}
}
version 0.25.0 (git version: a8cf800d4e9fdd7b4293a886490c40309a5bb58c)
Using this post command:
curl localhost:1026/v1/updateContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d #entity1.json -v
and entity json
entity1.json:http://pastebin.com/Esraq80S
Observed behavior:
On cleaned db (removed all entities) and service restarted the post is succesfull in the 1st time and fails in the following ones.
Thanks a lot!!
Based on user report (see coments thread on the question post), upgrading to Orion 1.1.0 solves de problem.
The cause of the problem in 0.25.0 remains unknown. The changelog from 0.25.0 to 1.1.0 at https://github.com/telefonicaid/fiware-orion/releases could be carefully examined in order to find the fix, but probably it doesn't worth the time.

wget 400 bad request

i'm trying to download the data from OSM, this guide says that i can do this with following command:
wget -O muenchen.osm "http://api.openstreetmap.org/api/0.6/map?bbox=11.54,48.14,11.543,48.145"
This command works fine, but when i'm trying to download my map:
wget -O muenchen.osm "http://api.openstreetmap.org/api/0.6/map?bbox=34.3893,49.5277,34.7195,49.6727"
it says:
Resolving api.openstreetmap.org... 193.63.75.100, 193.63.75.99, 193.63.75.103, ...
Connecting to api.openstreetmap.org|193.63.75.100|:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
2013-12-19 11:47:41 ERROR 400: Bad Request.
Any ideas what am i doing wrong? Thanks
You get a 400 error "When any of the node/way/relation limits are crossed" (source). Try to make your bounding box smaller.