Return webhook configuration info for integrating external annotation tools.
(label_view_name: str)
| 693 | |
| 694 | @rest_app.get("/webhook/config/{label_view_name}") |
| 695 | def webhook_config(label_view_name: str): |
| 696 | """Return webhook configuration info for integrating external annotation tools.""" |
| 697 | try: |
| 698 | fv = store.registry.get_label_view(label_view_name, store.project) |
| 699 | push_source_name = fv.source.name if fv.source else None |
| 700 | feature_names = [f.name for f in fv.features] |
| 701 | entity_names = [ec.name for ec in fv.entity_columns] |
| 702 | labeler_field = getattr(fv, "labeler_field", None) |
| 703 | |
| 704 | return { |
| 705 | "label_view": label_view_name, |
| 706 | "push_source_name": push_source_name, |
| 707 | "webhook_url": "/api/v1/webhook/label-ingest", |
| 708 | "batch_url": "/api/v1/batch-push", |
| 709 | "required_fields": entity_names |
| 710 | + feature_names |
| 711 | + ([labeler_field] if labeler_field else []), |
| 712 | "entity_fields": entity_names, |
| 713 | "label_fields": feature_names, |
| 714 | "labeler_field": labeler_field, |
| 715 | "payload_example": { |
| 716 | "push_source_name": push_source_name, |
| 717 | "records": [ |
| 718 | { |
| 719 | **{e: f"<{e}_value>" for e in entity_names}, |
| 720 | **{f: f"<{f}_value>" for f in feature_names}, |
| 721 | **( |
| 722 | {"event_timestamp": "2026-01-01T00:00:00Z"} |
| 723 | if True |
| 724 | else {} |
| 725 | ), |
| 726 | **( |
| 727 | {labeler_field: "<labeler_id>"} if labeler_field else {} |
| 728 | ), |
| 729 | } |
| 730 | ], |
| 731 | }, |
| 732 | } |
| 733 | except Exception: |
| 734 | logger.exception("Webhook config lookup failed") |
| 735 | return _safe_error_response("Webhook config", status.HTTP_404_NOT_FOUND) |
| 736 | |
| 737 | @rest_app.get("/annotation-config/{label_view_name}") |
| 738 | def annotation_config(label_view_name: str): |
nothing calls this directly
no test coverage detected