Open jshimko opened 7 years ago
So, I think this is just a peculiarity of curl
and the order of arguments on the command line. I was able to reproduce this by putting the header and body arguments after the URL.
Reproduced Failure:
$ curl http://localhost:8080/v1/projects/6f6c206e/applications -H "Content-Type: application/json" -d'{"namespaceid":"fc0c6a6b"}'
{
"id": "rFzsPcwX",
"code": "bad_request",
"status": 400,
"detail": "[WSUhRC52] 400 invalid_request: attribute \"name\" of response is missing and required; attribute \"namespace_id\" of response is missing and required, attribute: namespace_id, parent: response"
}
Only change is to add a -XGET
parameter after the URL.
Working:
$ curl http://localhost:8080/v1/projects/6f6c206e/applications -XGET -H "Content-Type: application/json" -d'{"namespaceid":"fc0c6a6b"}'
[{
"channel": "stable",
"config": "",
"created_at": "2017-09-18T22:32:31.325098155-07:00",
"deployment_name": "illinois-urbana-mongodb",
"id": "7412131c",
"json_values": "",
"name": "mongodb-replicaset",
"namespace_id": "fc0c6a6b",
"registry": "samsung_cnct",
"server": "quay.io",
"status": {
"deployed_at": "2017-09-18T22:32:31.325669159-07:00",
"state": "DEPLOYED"
},
"type": "application",
"updated_at": "2017-09-18T22:32:31.325669175-07:00",
"username": "",
"version": "latest"
}]
@jshimko - will leave this open until tomorrow so you have a chance to verify.
So I guess I'm not exactly sure it this isn't a bug though, because I don't have the same issue with any other API I've just tested (5 different ones). Even doing a GET for a single item on krak8s allows you to have that same header and not use -X GET
, so at the very least it's inconsistent.
curl http://localhost:8080/v1/projects/77907b06/applications/bb7dd432 \
-H "Content-Type: application/json"
{
"channel": "stable",
"config": "",
"created_at": "2017-09-18T13:35:53.981897503Z",
"deployment_name": "jeremy-mongodb",
"id": "bb7dd432",
"json_values": "",
"name": "mongodb-replicaset",
"namespace_id": "02678191",
"registry": "quay.io/samsung_cnct",
"server": "quay.io",
"status": {
"deployed_at": "0001-01-01T00:00:00Z",
"state": "UNKNOWN"
},
"type": "application",
"updated_at": "2017-09-18T13:35:53.981897503Z",
"username": "",
"version": "latest"
}
Anyway, if the API is going to choke on something like this, you may want to add some more useful error handling there. Because the error detail it spit out is completely incorrect. That's not actually what caused the error.
{
"id": "rFzsPcwX",
"code": "bad_request",
"status": 400,
"detail": "[WSUhRC52] 400 invalid_request: attribute \"name\" of response is missing and required; attribute \"namespace_id\" of response is missing and required, attribute: namespace_id, parent: response"
}
Consideration for future enhancement.
I have a project, namespace, cluster, etc. and a single application running. I can query for the single application and successfully get it, but I can't list applications in that same namespace.
Yes, I realize my body has
namespaceid
instead ofnamespace_id
, but that’s what the spec says. Regardless, I tried both ways and got the same result.Just to show you that the namespace definitely exists...