I am trying to pass a time value as a string in the path to a Google endpoints API.
If I use "15:00" as the value, I get the error:
"No endpoint found for path: conference/v1/dislikedSessions/Keynote/15:00"
The path is found if I send a string like "void" or a number like "1500".
Resource Container
SESS_TYPETIME_REQUEST = endpoints.ResourceContainer(
message_types.VoidMessage,
typeOfSession=messages.StringField(1),
startTime=messages.StringField(2),
)
Endpoint code:
@endpoints.method(SESS_TYPETIME_REQUEST, SessionForms,
path='dislikedSessions/{typeOfSession}/{startTime}',
http_method='GET', name='dislikedSessions')
def dislikedSessions(self, request):
"""Return sessions that are not of specified type and earlier than start time."""
filterTime = datetime.strptime(urllib2.unquote(request.startTime), "%H:%M").time()
Yeah, I can use just the numbers (with a change to the strptime method), but I can't understand why the path won't pick up the string like 15:59?
Thanks, Justin.
Aucun commentaire:
Enregistrer un commentaire