# Bug OP-10815 - Invalid link/href returned by API

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-10815

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | High |
| Module |  |
| Target versions | 12.2.0 |
| Observed in versions | 12.1.0 |
| Sprint | 12.2.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 12.1.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  have \> 20 work packages (more than a singly page for paged api calls)
2.  query `/api/v3/work_packages`
3.  query the endpoint provided in the reply from the previous step under `_links -> nextByOffset`
    1.  href is `'/api/v3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%22%22%5D%7D%7D%5D&offset=2&pageSize=20&select=&showHierarchies=true&showSums=false&sortBy=%5B%5B%22id%22%2C%22asc%22%5D%5D`

### What is the buggy behavior?

An empty json response `{}` is returned, where I expect the next batch of work packages to be returned.

Reason seems to be that a `select=` is included in the href, even though I never supplied a `select` to my initial query. When sending this to OpenProject it is interpreted as `"select"=>""` being the empty string instead of select not being supplied at all or as supplied without the `=` sign like `&pageSize=20&select&showHierarchies=true`

### **Logs**

Using the URL as provided in the response from the query in step 2 using `select=` Note that this is interpreted as `"select"=>""`. It returns a quick yet empty response.

``` text
Aug  1 10:54:29 openproject_enterprise openproject-web-1.service[14425]: I, [2022-08-01T10:54:29.288680 #14547]  INFO -- : Started GET "/api/v3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%22%22%5D%7D%7D%5D&offset=2&pageSize=20&select=&showHierarchies=true&showSums=false&sortBy=%5B%5B%22id%22%2C%22asc%22%5D%5D" for 10.2.32.2 at 2022-08-01 10:54:29 +0000
Aug  1 10:54:29 openproject_enterprise openproject-web-1.service[14425]: I, [2022-08-01T10:54:29.365440 #14547]  INFO -- : duration=69.24 db=17.77 view=51.47 status=200 method=GET path=/api/v3/work_packages params={"filters"=>"[{\"status\":{\"operator\":\"o\",\"values\":[\"\"]}}]", "offset"=>"2", "pageSize"=>"20", "select"=>"", "showHierarchies"=>"true", "showSums"=>"false", "sortBy"=>"[[\"id\",\"asc\"]]"} host=openproject.nsl.netscout.com user=2
```

Querying the same thing, but removing the `=` from `select=`. Note that this is interpreted as `"select"=>nil`. It returns a non-empty response as expected.

``` text
Aug  1 10:56:00 openproject_enterprise openproject-web-1.service[14425]: I, [2022-08-01T10:56:00.330732 #14551]  INFO -- : Started GET "/api/v3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%22%22%5D%7D%7D%5D&offset=2&pageSize=20&select&showHierarchies=true&showSums=false&sortBy=%5B%5B%22id%22%2C%22asc%22%5D%5D" for 10.2.32.2 at 2022-08-01 10:56:00 +0000
Aug  1 10:56:01 openproject_enterprise openproject-web-1.service[14425]: I, [2022-08-01T10:56:01.069775 #14551]  INFO -- : duration=730.29 db=98.33 view=631.96 status=200 method=GET path=/api/v3/work_packages params={"filters"=>"[{\"status\":{\"operator\":\"o\",\"values\":[\"\"]}}]", "offset"=>"2", "pageSize"=>"20", "select"=>nil, "showHierarchies"=>"true", "showSums"=>"false", "sortBy"=>"[[\"id\",\"asc\"]]"} host=openproject.nsl.netscout.com user=2
```

Querying the same thing, but with removing `select=` complete. Note that `select` is not present in the interpretation this time and yields a non-empty response too.

``` text
Aug  1 10:57:30 openproject_enterprise openproject-web-1.service[14425]: I, [2022-08-01T10:57:30.563687 #14551]  INFO -- : Started GET "/api/v3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%22%22%5D%7D%7D%5D&offset=2&pageSize=20&showHierarchies=true&showSums=false&sortBy=%5B%5B%22id%22%2C%22asc%22%5D%5D" for 10.2.32.2 at 2022-08-01 10:57:30 +0000
Aug  1 10:57:31 openproject_enterprise openproject-web-1.service[14425]: I, [2022-08-01T10:57:31.376608 #14551]  INFO -- : duration=807.12 db=89.67 view=717.45 status=200 method=GET path=/api/v3/work_packages params={"filters"=>"[{\"status\":{\"operator\":\"o\",\"values\":[\"\"]}}]", "offset"=>"2", "pageSize"=>"20", "showHierarchies"=>"true", "showSums"=>"false", "sortBy"=>"[[\"id\",\"asc\"]]"} host=openproject.nsl.netscout.com user=2
```

### Environment information

**OpenProject installation type**

Packaged installation on Ubuntu 18.04

**OpenProject version**

Enterprise v12.1.6

**Browser**

Python requests library

**Language**

English
