# MembershipsUpdateResponse required fields are not returned on API operations

**URL:** <https://community.hubspot.com/t/membershipsupdateresponse-required-fields-are-not-returned-on-api-operations/107218>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [May 15, 2024, 2:27pm UTC](https://community.hubspot.com/t/membershipsupdateresponse-required-fields-are-not-returned-on-api-operations/107218 "2024-05-15T14:27:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RMoldes](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@RMoldes](https://community.hubspot.com/u/RMoldes)\
**Post date:** [May 15, 2024, 2:27pm UTC](https://community.hubspot.com/t/membershipsupdateresponse-required-fields-are-not-returned-on-api-operations/107218/1 "2024-05-15T14:27:12Z")

</div>

Hello,

First of all, thanks for all the support provided regarding OpenAPI usage.

## Problem

We are currently using the HubSpot OpenAPI spec to auto-generate a client for a Kotlin based application we are working on.  
We’ve successfully integrated it and managed to generate all required code. Also made some tests to retrieve some entities and seems to be working like a charm.

After some testing, we are having an error with the [Add records to a List](https://github.com/HubSpot/HubSpot-public-api-spec-collection/blob/main/PublicApiSpecs/CRM/Lists/Rollouts/144891/v3/lists.json#L351) operation (Probably happening with other operations on the List Membermship API).  
As described in the specification, it should return a [MembershipsUpdateResponse](https://github.com/HubSpot/HubSpot-public-api-spec-collection/blob/main/PublicApiSpecs/CRM/Lists/Rollouts/144891/v3/lists.json#L2254), and we are getting an error when the client tries to parse the reponse body, as it expecting some [required fields](https://github.com/HubSpot/HubSpot-public-api-spec-collection/blob/main/PublicApiSpecs/CRM/Lists/Rollouts/144891/v3/lists.json#L2255) that are not returned when adding a record to a List (e.g: recordIdsRemoved)

```auto
com.squareup.moshi.JsonDataException: Required value 'recordIdsRemoved' missing at $
	at com.squareup.moshi.internal.Util.missingProperty(Util.java:660)
	at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapter.fromJson(KotlinJsonAdapter.kt:105)
	at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
	at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:70)
	at com.hubspot.lists.api.MembershipsApi.putCrmV3ListsListIdMembershipsAddWithHttpInfo(MembershipsApi.kt:1405)
	at com.hubspot.lists.api.MembershipsApi.putCrmV3ListsListIdMembershipsAdd(MembershipsApi.kt:225)
[...]

```

The actual response from the API is like ([required fields](https://github.com/HubSpot/HubSpot-public-api-spec-collection/blob/main/PublicApiSpecs/CRM/Lists/Rollouts/144891/v3/lists.json#L2255C45-L2255C61) are not present in the response):

```auto
{
 "recordsIdsAdded": [
 "13XXXXXXXX"
 ]
}

```

## Workarround

After digging and debugging a bit the issue, we removed the [required fields](https://github.com/HubSpot/HubSpot-public-api-spec-collection/blob/main/PublicApiSpecs/CRM/Lists/Rollouts/144891/v3/lists.json#L2255C45-L2255C61) of MembershipsUpdateResponse from the local file for the OpenAPI specification we use and regenerated again all the code for the client.  
This seems to be fixing the issue and we can now successfully run the [Add records to a List](https://github.com/HubSpot/HubSpot-public-api-spec-collection/blob/main/PublicApiSpecs/CRM/Lists/Rollouts/144891/v3/lists.json#L351) operation.  
I’ve already created a Github issue in case it helps to keep track of this issue/question:  
- [MembershipsUpdateResponse required fields are not returned on API operations · Issue #15 · HubSpot/HubSpot-public-api-spec-collection · GitHub](https://github.com/HubSpot/HubSpot-public-api-spec-collection/issues/15)  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [May 16, 2024, 5:57pm UTC](https://community.hubspot.com/t/membershipsupdateresponse-required-fields-are-not-returned-on-api-operations/107218/2 "2024-05-16T17:57:49Z")

</div>

Thanks for sharing your workaround. And thank you for taking the time to file the GitHub issue — Jaycee

---

<div class="post-metadata">

**Author:** ![RMoldes](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@RMoldes](https://community.hubspot.com/u/RMoldes)\
**Post date:** [May 23, 2024, 8:31am UTC](https://community.hubspot.com/t/membershipsupdateresponse-required-fields-are-not-returned-on-api-operations/107218/3 "2024-05-23T08:31:11Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) ,  
Thanks for your response.  
Are there any plans to take any action on this issue?  
Regards,
