# Partner Profile Resource Type
## Registration
Let's assume that there's a way to register that points at an external location for the schema and context.
```python
from importlib import resources
from scrud import register_resource_type
register_resource_type(
json_schema_url="https://api.openteams.com/json-schema/PartnerProfile",
json_ld_context_url="https://api.openteams.com/json-ld/PartnerProfile",
rdf_type_uri="https://api.openteams.com/json-ld/PartnerProfile",
slug="partner-profiles", # make a collection endpoint
)
```
What does this mean??
### The ResourceType
The registration creates a ResourceType:
```python
partner_profile_resource_type = ResourceType(
schema_uri="https://api.openteams.com/json-schema/PartnerProfile",
context_uri="https://api.openteams.com/json-ld/PartnerProfile",
type_uri="https://api.openteams.com/json-ld/PartnerProfile",
slug="partner-profiles",
)
```
### The Collection for the ResourceType
```python
from scrud.collections import register_collection_resource_type
from openteams.resources import (
partner_profile_resource_type, customer_profile_resource_type,
)
register_collection_resource_type(
partner_profile_resource_type,
customer_profile_resource_type,
)
```
### The Service Catalog that results
```json
{
"https://api.openteams.com/json-ld/PartnerProfile":
"/partner-profiles"
, "https://api.openteams.com/json-ld/CustomerProfile":
"/customer-profiles"
}
```
# Instances of the Partner Profile ResourceType
These are created via POST to `/partner-profiles`
```python
semantics_crud = Resource(
resource_type = partner_profile_resource_type
content = "{...}" # some JSON content
...
)
```
# Registration implies a collection
That is, given:
```python
from importlib import resources
from scrud import register_resource_type
register_resource_type(
json_schema_url="https://api.openteams.com/json-schema/PartnerProfile",
json_ld_context_url="https://api.openteams.com/json-ld/PartnerProfile",
rdf_type_uri="https://api.openteams.com/json-ld/PartnerProfile",
slug="partner-profiles", # make a collection endpoint
)
```
Then for any Partner Profile resource with `id=42`, the URL of that resource would be `/partner-profiles/42`.
Or, if resources have slugs, something like `/partner-profiles/forty-two` if the slug were `forty-two` for the Partner Profile resource.
# Let's reconsider registration, in `urls.py`
```python
# in urls.py
from importlib import resources
from rest_framework.routers import DefaultRouter
from scrud import register_resource_type
router = DefaultRouter()
register_resource_type(
router=router,
json_schema_url="https://api.openteams.com/json-schema/PartnerProfile",
json_ld_context_url="https://api.openteams.com/json-ld/PartnerProfile",
rdf_type_uri="https://api.openteams.com/json-ld/PartnerProfile",
slug="partner-profiles", # make a collection endpoint
)
```