I'm trying to use HTTP GET method using:
curl http://localhost:8888/_ah/api/birra/v1/beer
it's returning me the current list like which is normal and expected:
{
"items" : [ {
"id" : "1",
"beerName" : "Bud"
}, {
"id" : "2",
"beerName" : "Steve"
}, {
"id" : "3",
"beerName" : "Ankur"
} ]
}
But when i'm doing HTTP POST like this:
curl -X POST -H "Content-Type: application/json" -H "Accept:application/json" -d "{\"beerName\": \"asdf\"}" http://localhost:8888/_ah/api/birra/v1/beer
it's giving me error as:
{
"error" : {
"message" : "javax.jdo.JDOFatalInternalException: The key value passed to construct a SingleFieldIdentity of type \"class javax.jdo.identity.LongIdentity\" for class \"class com.samples.Beer\" is null.\nNestedThrowables:\norg.datanucleus.exceptions.NucleusException: The key value passed to construct a SingleFieldIdentity of type \"class javax.jdo.identity.LongIdentity\" for class \"class com.samples.Beer\" is null.",
"code" : 503,
"errors" : [ {
"domain" : "global",
"reason" : "backendError",
"message" : "javax.jdo.JDOFatalInternalException: The key value passed to construct a SingleFieldIdentity of type \"class javax.jdo.identity.LongIdentity\" for class \"class com.samples.Beer\" is null.\nNestedThrowables:\norg.datanucleus.exceptions.NucleusException: The key value passed to construct a SingleFieldIdentity of type \"class javax.jdo.identity.LongIdentity\" for class \"class com.samples.Beer\" is null."
} ]
}
}
I'm currently working on Google Cloud Endpoints sample provided on: Cloud Endpoint by Google Developers
I'm using Eclipse IDE with server localhost running on Jetty.
Any solutions?
Use double quote instead of single. This type of errors occur when you are running from windows. That's why it says couldn't resolve host.
curl -H "Content-Type: application/json" -d "{\"beerName\": \"bud\"}" http://localhost:8888/_ah/api/birra/v1/beer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With