# ows-product-store-mapping
Microservice for mapping Orchard products to store-specific identifiers.

## Endpoints
### Get product ID mapping for entire release:
GET: `/mapping/product/{product_id}/store/{dms_id}`

Response:
```
{
    "product": {
        "store_unique_id": 1234654,
        "provider": "orchard",
        "custom_id": "807978099098790"
    },
    "tracks": {
        "1": {
            "store_unique_id": 12346545234,
            "custom_id": "34523452345_ASDF3412341"
        },
        "2": {
            "store_unique_id": 12346542345,
            "custom_id": "34523452345_ASDF3414534"
        }
    }
}
```

### Get product ID mapping for only release level:
GET: `/mapping/product/{product_id}/store/{store_id}/product`

Response:
```
{
    "store_unique_id": 1234654,
    "provider": "orchard",
    "custom_id": "807978099098790"
}
```

### Get product ID mapping for specific track:
GET: `/mapping/track/{track_unique_id}/store/{dms_id}/track`

Response:
```
{
    "store_unique_id": 12346545234,
    "custom_id": "34523452345_ASDF3412341"
}
```

### Save mapping data for specific product:
POST: `/mapping/product/<int:product_id>/store/<int:store_id>/product`

Body:
```
{
    "provider": "Orchard",
    "video_order_id": "USALL0300140",
    "store_unique_id": 0
}
```

Response:
```
{
    "product_id": 1024,
    "store_id": 463,
    "provider": "Orchard",
    "video_order_id": "USALL0300140",
    "store_unique_id": 0
}
```

### Delete mapping data for specific product:
DELETE: `/mapping/product/<int:product_id>/store/<int:store_id>/product`

Response:
```
{
    "success": "mapping deleted succssfully"
}
```

