Improves check for api requests.

Timelines introduces a case where the json format is negotiated
but not represented in the format parameter via routes (i.e., the
extension ".json"). This change adds support for Accept-header content
negotiation, which results in the format field of the request. For
consistency, xml was also added.