Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func handleVideoInfo(w http.ResponseWriter, r *http.Request) {
_, span := tracer.Start(r.Context(), "handleVideoInfo")
defer span.End()

videoID := r.URL.Query().Get("video_id")
videoID := r.URL.Query().Get("videoid")
if videoID == "" {
hlog.FromRequest(r).Error().Msg("video_id parameter is missing")
http.Error(w, "video_id parameter is missing", http.StatusBadRequest)
hlog.FromRequest(r).Error().Msg("videoid parameter is missing")
http.Error(w, "videoid parameter is missing", http.StatusBadRequest)
return
}

Expand Down
23 changes: 23 additions & 0 deletions spec/ytstat-openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
penapi: 3.0.0
info:
title: Youtube Statistics API
description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
version: 0.1.9
servers:
- url: http://api.example.com/v1
description: Optional server description, e.g. Main (production) server
- url: http://staging-api.example.com
description: Optional server description, e.g. Internal staging server for testing
paths:
/videoid:
get:
summary: Returns stats for the give video id.
description: Optional extended description in CommonMark or HTML.
responses:
'200': # status code
description: JSON document with stats for the video
content:
application/json:
schema:
type: object