support setting category slug

Related: https://meta.discourse.org/t/custom-value-for-category-slug/22812

1. slug param exists and valid: use the provided
2. slug param exists but invalid: use the default
3. slug param not exists: use the default

And also a slug api.