0
votes

My'm having a weird issue that I cant figure out. I have a Web Service set up on Google App Engine. I can test it from the Google APIs Explorer and I get data back. But when I copy and paste URL that's associated with the API link below (app info removed for security purposes), I get a "NOT FOUND" error on the page. It should return some JSON data.

Does anyone have a clue as to why this is happening?

This is my Servlet code

@ApiMethod(name="updateHighFive")
public Event addHighFive(@Named("eventid") int eventid, @Named("userid") int userid) throws NotFoundException{
    //parameters needed
    //eventid
    //title
    //description
    //categoryid
    Event event = new Event();
    event = MyDB.AddHighFive(eventid, userid);

    return event;
}

and this is the code for my DB connection.

public static Event AddHighFive(int eventid, int userid) {
Event event = null;
Connection connection;
CallableStatement statement=null;
int rs = 0;

String callStatement = "{call AddHighFive(?,?)}";

try{
    connection=getConnection();
    statement = connection.prepareCall(callStatement);
    statement.setInt(1, eventid);
    statement.setInt(2, userid);
    rs = statement.executeUpdate();
    if(rs != 0){
        event = new Event();
        event.setId(eventid);
    }
    statement.close();
    connection.close();
}catch (SQLException ex){
    System.out.println("Error: " + ex.toString());
    System.out.println("Query: " + statement.toString());
}
return event;

}

Request

POST https://myapi-webservice-01.appspot.com/_ah/api/api/v1/addHighFive/4/1

X-JavaScript-User-Agent: Google APIs Explorer

Response

200 OK

  • Show headers -

{

"id": 4,

"highFives": 0,

"going": 0,

"currentlyHere": 0,

"categoryid": 0,

"userId": 0,

"kind": "myapi#resourcesItem",

"etag": "\"4nNuVpsUM8obBGiS0qN7CVracwc/L7tNRSrZhr-ryKSf0HchvG1lWC4\""

}

1

1 Answers

0
votes

When you copy-paste the url to your browser, you are executing a GET method. Try using curl -XPOST {url} instead.