Skip to content

prefect.server.api.collections

read_view_content(view) async

Reads the content of a view from the prefect-collection-registry.

Source code in src/prefect/server/api/collections.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@router.get("/views/{view}")
async def read_view_content(view: str) -> Dict[str, Any]:
    """Reads the content of a view from the prefect-collection-registry."""
    try:
        return await get_collection_view(view)
    except KeyError:
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND,
            detail=f"View {view} not found in registry",
        )
    except httpx.HTTPStatusError as exc:
        if exc.response.status_code == 404:
            raise HTTPException(
                status_code=status.HTTP_404_NOT_FOUND,
                detail=f"Requested content missing for view {view}",
            )
        else:
            raise