Inconsistent JSON responses in Search and Native API for collections
Open
Nobody has claimed this yet.
Feature: API
Type: Suggestion
User Role: API User
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 564
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 29
Description
What steps does it take to reproduce the issue?/ What happens?
- Obtain the information of a single dataverse via
curl "https://demo.dataverse.org/api/dataverses/root" | jqResponse: [1] - Search for root dataverse via
curl "https://demo.dataverse.org/api/search?type=dataverse&q=root" | jqResponse: [2] - Compare the responses [1] and [2]. I expect the search response to be a subset of the details provided by the native API to obtain a single dataverse. However, "published_at" is only available via search. "alias" is called "identifier" within the search response, which is a bit confusing especially since there is a property "id" with the numerical database id of the dataverse.
[1]
{
"status": "OK",
"data": {
"id": 2067773,
"alias": "DVC_2023",
"name": "Dataverse Community Meeting, 2023",
"affiliation": "Harvard University",
"dataverseContacts": [
{
"displayOrder": 0,
"contactEmail": "sbarbosa@hmdc.harvard.edu"
}
],
"permissionRoot": true,
"description": "This collection supports the Dataverse Community Meeting, 2023 training website.",
"dataverseType": "TEACHING_COURSES",
"ownerId": 1,
"creationDate": "2023-06-05T07:40:29Z",
"theme": {
"id": 716,
"logo": "NE_Revolution_Logos_Seal_Primary_RGB.jpg",
"tagline": "I love football!!",
"linkUrl": "https://www.boston.com/",
"linkColor": "000d08",
"textColor": "888888",
"backgroundColor": "f7b100",
"logoBackgroundColor": "08e7f7"
}
}
}
[2]
{
"status": "OK",
"data": {
"q": "root",
"total_count": 3,
"start": 0,
"spelling_alternatives": {},
"items": [
{
"name": "Logo Bug Root",
"type": "dataverse",
"url": "https://demo.dataverse.org/dataverse/logobugroot",
"identifier": "logobugroot",
"published_at": "2021-11-23T11:30:06Z"
},
{
"name": "Tania Schlatter Dataverse in Root",
"type": "dataverse",
"url": "https://demo.dataverse.org/dataverse/TSD_Root",
"identifier": "TSD_Root",
"published_at": "2021-11-16T11:37:10Z"
},
{
"name": "Oscar Moreno Dataverse",
"type": "dataverse",
"url": "https://demo.dataverse.org/dataverse/root",
"identifier": "root",
"published_at": "2022-09-20T14:06:00Z"
}
],
"count_in_response": 3
}
}
To whom does it occur (all users, curators, superusers)?
API users
What did you expect to happen?
- Proposed change: include "published_at" within the detailed response.
- Proposed change: renaming of "identifier" to "alias" to be consistent across API responses.
- Proposed addition: In order to recreate the dataverse result cards within a SPA I want all the information needed tobe included within the the search response. Here the information like description, affiliation, parent dataverse, link to logo and information about the "linked" status are missing. Hence, I'd like those tobe included.
- Proposed addition: Add parent dataverse and "linked" status to the detailed response.
- Proposed change: Change value of
logoin detailed response to be a URL, that can be used in HTML markup.
When does this issue occur?
Whenever I use the API.
Which page(s) does it occurs on?
API (see above)
Which version of Dataverse are you using?**
The latest
Any related open or closed issues to this bug report?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the native dataverse endpoint at /api/dataverses/root with the search endpoint at /api/search?type=dataverse&q=root using the supplied curl examples. Review the response contracts for naming, publication data, parent and linked status, and logo URLs; done means the agreed fields are consistent and sufficient for the requested API clients.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100