> For the complete documentation index, see [llms.txt](https://openup.gitbook.io/cape-agulhas-app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://openup.gitbook.io/cape-agulhas-app/api/service-requests.md).

# Service Requests

## List Service Requests

<mark style="color:blue;">`GET`</mark> `https://muni-portal-backend.openup.org.za/api/service-requests/`

Retrieve a list of Service Request objects that belong to the user making the request.

{% tabs %}
{% tab title="200 Successful response with multiple objects" %}

```python
[
    {
        "id": 3,
        "collaborator_object_id": 556706,
        "type": "Roads",
        "user_name": "Mr Test",
        "user_surname": "Surname",
        "user_mobile_number": "0792816737",
        "user_email_address": "user@example.com",
        "municipal_account_number": null,
        "street_name": "Geen Straat",
        "street_number": "123",
        "suburb": "Daar",
        "description": "Iets is fout",
        "coordinates": null,
        "request_date": "2020-01-01",
        "mobile_reference": "12345",
        "on_premis_reference": "373834",
        "status": "Registered",
        "demarcation_code": "WC033",
        "user": 1
    },
    {
        "id": 2,
        "collaborator_object_id": 556705,
        "type": "Sewerage",
        "user_name": "Mr JD",
        "user_surname": "Bothma",
        "user_mobile_number": "0792816737",
        "user_email_address": "jd@openup.org.za",
        "municipal_account_number": null,
        "street_name": "Geen Straat",
        "street_number": "123",
        "suburb": "Daar",
        "description": "This one has the date 2020-02-04 sent from the app",
        "coordinates": "12.3, 45.6",
        "request_date": "2020-02-04",
        "mobile_reference": null,
        "on_premis_reference": "373762",
        "status": "Assigned",
        "demarcation_code": "WC033",
        "user": 1
    },
    {
        "id": 1,
        "collaborator_object_id": 556704,
        "type": "Sewerage",
        "user_name": "Mr JD",
        "user_surname": "Bothma",
        "user_mobile_number": "0792816737",
        "user_email_address": "jd@openup.org.za",
        "municipal_account_number": null,
        "street_name": "Geen Straat",
        "street_number": "123",
        "suburb": "Daar",
        "description": "This one has the date 2020-02-01 sent from the app",
        "coordinates": "12.3, 45.6",
        "request_date": "2020-02-01",
        "mobile_reference": null,
        "on_premis_reference": "373761",
        "status": "Assigned",
        "demarcation_code": "WC033",
        "user": 1
    }
]
```

{% endtab %}
{% endtabs %}

## Detail Service Request

<mark style="color:blue;">`GET`</mark> `https://muni-portal-backend.openup.org.za/api/service-requests/:id/`

Retrieve detail about a Service Request object.

#### Path Parameters

| Name | Type    | Description                       |
| ---- | ------- | --------------------------------- |
| id   | integer | Service Request object identifier |

{% tabs %}
{% tab title="200 Successful response if the object was found." %}

```
{
    "id": 1,
    "collaborator_object_id": 556704,
    "type": "Sewerage",
    "user_name": "Mr JD",
    "user_surname": "Bothma",
    "user_mobile_number": "0792816737",
    "user_email_address": "jd@openup.org.za",
    "municipal_account_number": null,
    "street_name": "Geen Straat",
    "street_number": "123",
    "suburb": "Daar",
    "description": "This one has the date 2020-02-01 sent from the app",
    "coordinates": "12.3, 45.6",
    "request_date": "2020-02-01",
    "mobile_reference": null,
    "on_premis_reference": "373761",
    "status": "Assigned",
    "demarcation_code": "WC033",
    "user": 1
}
```

{% endtab %}

{% tab title="404 Fail response if the object was not found." %}

```
{
    "detail": "Not found."
}
```

{% endtab %}
{% endtabs %}

## Create Service Request

<mark style="color:green;">`POST`</mark> `https://muni-portal-backend.openup.org.za/api/service-requests/`

Create a Service Request object. \
\
The object is not visible in List or Detail views until it has successfully been created in Collaborator Web API. \
\
If the object does show up in List or Detail views, it has successfully been created in Collaborator Web API and will have the status "created."

#### Request Body

| Name                 | Type   | Description                                                           |
| -------------------- | ------ | --------------------------------------------------------------------- |
| coordinates          | string | Latitude, Longitude as Decimal Degrees e.g. `-34.8161234, 19.9712024` |
| description          | string | Description                                                           |
| suburb               | string | Suburb (We supply Town in this field)                                 |
| street\_number       | string | Street number                                                         |
| street\_name         | string | Street name                                                           |
| user\_mobile\_number | string | Mobile number                                                         |
| user\_surname        | string | Surname                                                               |
| user\_name           | string | First name                                                            |
| type                 | string | Type (Service Area)                                                   |

{% tabs %}
{% tab title="201 " %}

```
{}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://openup.gitbook.io/cape-agulhas-app/api/service-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
