Necessary information of any movie in Amazon, in JSON format, written in Go. Will be developed further.
- Summary of set up
go get ./..
change directory to project's folder
go build -o "films-api"
./films-api
Now you have a working Amazon films api where you can make requests from your favorite web browser.
- Dependencies
goquery: is used to fetch the needed parts of the movie webpage, in an easy manner.
mux: mux is used to create a router and its handlers. Easy to pass arguments via the route itself.
Depending on the Amazon's region of the movie ID - com, co.uk and de works fine for this implementation - specify the region and the movie ID to the link in your browser. Since hardcoding amazon.de for the base url region wouldn't give correct results for every region, specifying the region in the link seems to provide easier usage.
Sample execution: http://localhost:8080/movie/amazon/de/B00K19SD8Q
Result:
{
"title":"Um Jeden Preis",
"release_year":2013,
"actors":[
"Dennis Quaid",
" Zac Efron",
" Kim Dickens"
],
"posters":"https://images-eu.ssl-images-amazon.com/images/I/51VELYHd4TL._SX200_QL80_.jpg",
"similar_ids":[
"B00HDZMP94",
"B00JM0JXYI",
"B00L9KET84",
"B00O4G7QQ2",
"B00HUZXE8S",
"B00ILR6K9Y",
"B00I4DWI6O",
"B00ILNAY5O",
"B00HXL6E8G",
"B00ILNV05W",
"B00ILIGIU4",
"B00JKGLKFY",
"B00G0NPW1I",
"B00IK6HLUI",
"B00IYSFS6Q",
"B00N1ECZ2S",
"B01KUYZ6TU",
"B00JLCZN8M",
"B06XP6H33J",
"B00JKEXKCC"
]
}
Sample execution 2: http://localhost:8080/movie/amazon/co.uk/B00HDMDADW
Sample execution 3: http://localhost:8080/movie/amazon/com/B0018OFN1S
- RESTful request handling.
- ID validation