Mapping
Link two related items so each appears on the other's page.
A map is a cross-reference between two items -- a project and the service it used, an article and the person who wrote it. Each one appears on the other's page.
| Endpoint | What it does |
|---|---|
| GET /api/v1/site/{site}/artifacts/{slug}/maps/ | List this artifact's maps, paginated |
| POST /api/v1/site/{site}/artifacts/{slug}/maps/ | Create a map. artifact_b is required |
| GET /api/v1/site/{site}/artifacts/{slug}/maps/{pk}/ | Read one map |
| POST /api/v1/site/{site}/artifacts/{slug}/maps/{pk}/ | Change its target or order |
| DELETE /api/v1/site/{site}/artifacts/{slug}/maps/{pk}/ | Remove the cross-reference |
artifact_b takes the integer id of the other artifact, not its name. Read it from a list or get call first.
Request
curl -X POST -H "Authorization: Token $ENINE_TOKEN" -H "Content-Type: application/json" \
-d '{"artifact_b": 3104, "order": 1}' \
https://e9sites.com/api/v1/site/mysite.e9sites.com/artifacts/harbour-rebuild/maps/
import os
import requests
headers = {"Authorization": f"Token {os.environ['ENINE_TOKEN']}"}
base = "https://e9sites.com/api/v1/site/mysite.e9sites.com"
service = requests.get(f"{base}/artifacts/web-design/", headers=headers).json()
requests.post(
f"{base}/artifacts/harbour-rebuild/maps/",
json={"artifact_b": service["id"]},
headers=headers,
)
Both sides have to be items inside a category. Category roots themselves cannot be mapped -- attempting it is rejected.