Real Image Challenge 2016 - Distributors Permissions
The API enables you to determine global distribution rights for movies by checking territorial restrictions for distributors.
POST /distributors/permissionsDistributorRequest
| Parameter | Type | Description & Example |
|---|---|---|
distributor |
string |
Required Distributor1 |
include |
[]Location |
Required [{"country": "INDIA"}] |
exclude |
[]Location |
Optional [{"country": "CHINA"}] |
location |
[]Location |
Required [{"city": "CHENNAI","province": "TAMIL NADU","country": "INDIA"]} |
Location
| Parameter | Type | Description & Example |
|---|---|---|
City |
string |
Optional "CHENNAI" |
Province |
string |
Optional "TAMIL NADU" |
Country |
string |
Optional "INDIA" |
Takes the distributor, validates the request and returns whether they have permission to distribute in the selected locations.
Clone the project
git clone https://github.com/Junaid82774464/challenge2016.gitInstall dependencies
go mod init golangStart the server
go run main.goSample request
[
{
"distributor": "DISTRIBUTOR1",
"include": [
{
"country": "INDIA"
},
{
"country": "UNITED STATES"
}
],
"exclude": [
{
"province": "KARNATAKA",
"country": "INDIA"
},
{
"city": "CHENNAI",
"province": "TAMIL NADU",
"country": "INDIA"
}
],
"locations": [
{
"city": "CHICAGO",
"province": "ILLINOIS",
"country": "UNITED STATES"
},
{
"city": "CHENNAI",
"province": "TAMIL NADU",
"country": "INDIA"
}
]
}
]Sample 200 Response
[
{
"distributor": "DISTRIBUTOR1",
"permissions": "DISTRIBUTOR1 can distribute in CHICAGO-ILLINOIS-UNITED STATES"
},
{
"distributor": "DISTRIBUTOR1",
"permissions": "DISTRIBUTOR1 cannot distribute in CHENNAI-TAMIL NADU-INDIA"
}
]
Sample 400 Response
[
{
"Code": "400",
"Message": "One of the included regions is not found in the database for DISTRIBUTOR1"
}
]