Skip to content

Latest commit

 

History

History
454 lines (418 loc) · 12.8 KB

04.signal_detail.md

File metadata and controls

454 lines (418 loc) · 12.8 KB

Private V1 Signals


Getting the details of a Signal

Example:

URL: http://127.0.0.1:8000/signals/v1/private/signals/1

Request headers:

  • Authorization: Bearer {TOKEN}
  • Content-Type: application/json

Response body:

{
    "_links": {
        "curies": {
            "name": "sia",
            "href": "http://127.0.0.1:8000/signals/v1/relations"
        },
        "self": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1"
        },
        "archives": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/history"
        },
        "sia:attachments": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/attachments"
        },
        "sia:pdf": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/pdf"
        },
        "sia:context": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/context"
        }
    },
    "_display": "1 - m - None - 2022-11-24T12:00:00+01:00",
    "id": 1,
    "id_display": "SIG-1",
    "signal_id": "cfa97730-902a-44fe-bd98-21ac2675b938",
    "source": "Telefoon – Adoptant",
    "text": "My complaint",
    "text_extra": "",
    "status": {
        "text": null,
        "user": "[email protected]",
        "state": "m",
        "state_display": "Gemeld",
        "target_api": null,
        "extra_properties": null,
        "send_email": false,
        "created_at": "2022-11-24T12:00:00+01:00"
    },
    "location": {
        "id": 1,
        "stadsdeel": "A",
        "buurt_code": null,
        "area_type_code": null,
        "area_code": null,
        "area_name": null,
        "address": null,
        "address_text": "",
        "geometrie": {
            "type": "Point",
            "coordinates": [
                4.90022563,
                52.36768424
            ]
        },
        "extra_properties": null,
        "created_by": "[email protected]",
        "bag_validated": false
    },
    "category": {
        "sub": "Overig",
        "sub_slug": "overig",
        "main": "Overig",
        "main_slug": "overig",
        "category_url": "http://127.0.0.1:8000/signals/v1/public/terms/categories/overig/sub_categories/overig",
        "departments": "ASC",
        "created_by": "[email protected]",
        "text": null,
        "deadline": "2022-12-01T12:00:00+01:00",
        "deadline_factor_3": "2022-12-15T12:00:00+01:00"
    },
    "reporter": {
        "email": "[email protected]",
        "phone": "",
        "sharing_allowed": true,
        "allows_contact": true
    },
    "priority": {
        "priority": "normal",
        "created_by": "[email protected]"
    },
    "type": {
        "code": "SIG",
        "created_at": "2022-11-24T12:00:00+01:00",
        "created_by": "[email protected]"
    },
    "created_at": "2022-11-24T12:00:00+01:00",
    "updated_at": "2022-11-24T12:00:00+01:00",
    "incident_date_start": "2022-11-24T12:00:00+01:00",
    "incident_date_end": null,
    "operational_date": null,
    "has_attachments": false,
    "extra_properties": null,
    "notes": [
        {
            "text": "Automatische e-mail bij registratie van de melding is verzonden aan de melder.",
            "created_by": null
        }
    ],
    "has_parent": false,
    "has_children": false,
    "assigned_user_email": null
}

cURL:

curl --location --request GET 'http://127.0.0.1:8000/signals/v1/private/signals/1' \
--header 'Authorization: Bearer {TOKEN}' \ 
--header 'Content-Type: application/json'

The history of a Signal

This endpoint will give the history of a Signal. It can be filtered by adding a query parameter called what.

Example:

URL: http://127.0.0.1:8000/signals/v1/private/signals/1/history
URL with filtering: http://127.0.0.1:8000/signals/v1/private/signals/1/history?what=CREATE_NOTE

Request headers:

  • Authorization: Bearer {TOKEN}
  • Content-Type: application/json

Response body:

[
    {
        "identifier": "CREATE_NOTE_129",
        "when": "2022-11-24T12:00:00+01:00",
        "what": "CREATE_NOTE",
        "action": "Notitie toegevoegd:",
        "description": "Automatische e-mail bij registratie van de melding is verzonden aan de melder.",
        "who": "Signalen systeem",
        "_signal": 1
    },
    {
        "identifier": "UPDATE_TYPE_ASSIGNMENT_128",
        "when": "2022-11-24T12:00:00+01:00",
        "what": "UPDATE_TYPE_ASSIGNMENT",
        "action": "Type gewijzigd naar: Melding",
        "description": null,
        "who": "[email protected]",
        "_signal": 1
    },
    {
        "identifier": "UPDATE_PRIORITY_127",
        "when": "2022-11-24T12:00:00+01:00",
        "what": "UPDATE_PRIORITY",
        "action": "Urgentie gewijzigd naar: Normaal",
        "description": null,
        "who": "[email protected]",
        "_signal": 1
    },
    {
        "identifier": "UPDATE_CATEGORY_ASSIGNMENT_126",
        "when": "2022-11-24T12:00:00+01:00",
        "what": "UPDATE_CATEGORY_ASSIGNMENT",
        "action": "Categorie gewijzigd naar: Overig",
        "description": null,
        "who": "[email protected]",
        "_signal": 1
    },
    {
        "identifier": "UPDATE_SLA_125",
        "when": "2022-11-24T12:00:00+01:00",
        "what": "UPDATE_SLA",
        "action": "Servicebelofte:",
        "description": "Uw melding wordt ingepland: wij laten u binnen 5 werkdagen weten hoe en wanneer uw melding wordt afgehandeld. Dat doen we via e-mail.",
        "who": "[email protected]",
        "_signal": 1
    },
    {
        "identifier": "UPDATE_STATUS_124",
        "when": "2022-11-24T12:00:00+01:00",
        "what": "UPDATE_STATUS",
        "action": "Status gewijzigd naar: Gemeld",
        "description": null,
        "who": "[email protected]",
        "_signal": 1
    },
    {
        "identifier": "UPDATE_LOCATION_123",
        "when": "2022-11-24T12:00:00+01:00",
        "what": "UPDATE_LOCATION",
        "action": "Locatie gewijzigd naar:",
        "description": "Stadsdeel: CentrumLocatie is gepind op de kaart\n4.90022563, 52.36768424",
        "who": "[email protected]",
        "_signal": 1
    }
]

cURL:

curl --location --request GET 'http://127.0.0.1:8000/signals/v1/private/signals/1/history' \
--header 'Authorization: Bearer {TOKEN}' \ 
--header 'Content-Type: application/json'

The attachments of a Signal

Example:

URL: http://127.0.0.1:8000/signals/v1/private/signals/1/attachments

Request headers:

  • Authorization: Bearer {TOKEN}
  • Content-Type: application/json

Response body:

{
    "_links": {
        "self": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/attachments"
        },
        "next": {
            "href": null
        },
        "previous": {
            "href": null
        }
    },
    "count": 2,
    "results": [
        {
            "_display": "Attachment object (1)",
            "_links": {
                "self": {
                    "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/attachments/1"
                }
            },
            "location": "http://127.0.0.1:8000/signals/media/attachments/2022/11/24/example-1.png",
            "is_image": true,
            "created_at": "2022-11-24T12:00:00+01:00",
            "created_by": null
        },
        {
            "_display": "Attachment object (2)",
            "_links": {
                "self": {
                    "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/attachments/2"
                }
            },
            "location": "http://127.0.0.1:8000/signals/media/attachments/2022/11/24/example-2.jpg",
            "is_image": true,
            "created_at": "2022-11-24T13:00:00+01:00",
            "created_by": "[email protected]"
        }
    ]
}

cURL:

curl --location --request GET 'http://127.0.0.1:8000/signals/v1/private/signals/1/attachments' \
--header 'Authorization: Bearer {TOKEN}' \ 
--header 'Content-Type: application/json'

Getting a PDF of the Signal

This endpoint will return a PDF file containing the Signal information, including attachments and history. The PDF also contains a header with the username of the logged-in user and a date timestamp when the PDF is generated.

Example:

URL: http://127.0.0.1:8000/signals/v1/private/signals/1/pdf

Request headers:

  • Authorization: Bearer {TOKEN}
  • Content-Type: application/json

cURL:

curl --location --request GET 'http://127.0.0.1:8000/signals/v1/private/signals/1/pdf' \
--header 'Authorization: Bearer {TOKEN}' \ 
--header 'Content-Type: application/json'

The context of a Signal

The context gives a count of Signals that are near the location of the Signal. Also gives the number of Signals created by the Reporter. These are divided into open Signals, Signals that are closed and have positive feedback and Signals that are closed and have negative feedback.

Example:

URL: http://127.0.0.1:8000/signals/v1/private/signals/1/context

Request headers:

  • Authorization: Bearer {TOKEN}
  • Content-Type: application/json

Response body:

{
    "_links": {
        "curies": {
            "name": "sia",
            "href": "http://127.0.0.1:8000/signals/v1/relations"
        },
        "self": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/context"
        },
        "sia:context-reporter-detail": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/context/reporter"
        },
        "sia:context-geography-detail": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/context/near/geography"
        }
    },
    "near": {
        "signal_count": 1
    },
    "reporter": {
        "signal_count": 1,
        "open_count": 1,
        "positive_count": 0,
        "negative_count": 0
    }
}

cURL:

curl --location --request GET 'http://127.0.0.1:8000/signals/v1/private/signals/1/context' \
--header 'Authorization: Bearer {TOKEN}' \ 
--header 'Content-Type: application/json'

The context of a Signal (Reporter)

URL: http://127.0.0.1:8000/signals/v1/private/signals/1/context/reporter

Request headers:

  • Authorization: Bearer {TOKEN}
  • Content-Type: application/json

Response body:

{
    "_links": {
        "self": {
            "href": "http://127.0.0.1:8000/signals/v1/private/signals/1/context/reporter"
        },
        "next": {
            "href": null
        },
        "previous": {
            "href": null
        }
    },
    "count": 1,
    "results": [
        {
            "id": 1,
            "created_at": "2022-11-24T12:00:00+01:00",
            "category": {
                "sub": "Overig",
                "sub_slug": "overig",
                "departments": "ASC",
                "main": "Overig",
                "main_slug": "overig"
            },
            "status": {
                "state": "m",
                "state_display": "Gemeld"
            },
            "feedback": null,
            "can_view_signal": true,
            "has_children": false
        }
    ]
}

cURL:

curl --location --request GET 'http://127.0.0.1:8000/signals/v1/private/signals/1/context/reporter' \
--header 'Authorization: Bearer {TOKEN}' \ 
--header 'Content-Type: application/json'

The context of a Signal (near)

The signals that are near the current signal. This will return a feature collection that can be drawn on a map.

URL: http://127.0.0.1:8000/signals/v1/private/signals/1/context/near/geography

Request headers:

  • Authorization: Bearer {TOKEN}
  • Content-Type: application/json

Response body:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    4.90022563,
                    52.36768424
                ]
            },
            "properties": {
                "id": 2,
                "created_at": "2022-11-24T11:00:00+01:00",
                "status": {
                    "state": "o",
                    "state_display": "Afgehandeld"
                }
            }
        },
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    4.90022563,
                    52.36768424
                ]
            },
            "properties": {
                "id": 3,
                "created_at": "2022-11-24T13:00:00+01:00",
                "status": {
                    "state": "m",
                    "state_display": "Gemeld"
                }
            }
        }
    ]
}

cURL:

curl --location --request GET 'http://127.0.0.1:8000/signals/v1/private/signals/1/context/near/geography' \
--header 'Authorization: Bearer {TOKEN}' \ 
--header 'Content-Type: application/json'