API call not using all additionalData values

I have an API defined that looks like the following image (complete definition not shown).

The following is the call to that API in a JS query

await apiUpdateProfile.trigger({ additionalScope: {
varStatus: data.EditStatus ?? data.Status,
varAddress: data.EditAddress,
varCity: data.EditCity,
varState: data.EditState,
varZip: data.EditZip,
varStreet: null,
varIsMailStreet: data.EditIsMailStreet,
varMailAddress: data.EditMailAddress,
varMailCity: data.EditMailCity,
varMailState: data.EditMailState,
varMailZip: data.EditMailZip,
varCounty: data.EditCounty,
varLocation: data.EditLocation,
varSize: data.EditSize,
varBuildingType: data.EditBuildingType,
varIsBuildingOwner: data.EditIsBuildingOwner,
varSic: data.EditSIC,
varSalesVolume: data.EditSalesVolume,
varIsIntlBusiness: null,
varSizeAllSites: data.EditSizeAllSites,
varSizeExact: data.EditSizeExact,
varNoOfSites: data.EditNoOfSites,
varIsFaxIsPhone: null,
varIsOptedOut: null,
varIsOverride: bool2Char(data.EditAddressOverride),
varIsMailOverride: bool2Char(data.EditMailAddressOverride),
varAddressValidation: data.EditAddressValidation,
varMailAddressValidation: data.EditMailAddressValidation,
varAddressType: null,
varSuiteStatus: null,
varMsa: null,
varLatitude: data.EditLatitude,
varLongitude: data.EditLongitude,
varFollowUpDate: null,
varEnteredById: ResearchStatus.data.UpdatedBy[0],
varEnteredDate: s2n(ResearchStatus.data.Updated[0]),
varBuildingNo: data.EditBuildingNo,
varStartYear: data.EditStartYear,
varStreetNo: null,
varSuiteNo: data.EditSuiteNo,
varZipPlus: data.EditZipPlus,
varMailBuildingNo: data.EditMailBuildingNo,
varMailSuiteNo: data.EditMailSuiteNo,
varMailZipPlus: data.EditMailZipPlus,
varPropertyId: data.EditPropertyId,
varNaics: null,
varAreaCode: data.EditAreaCode,
varPhoneNo: data.EditPhoneNo,
varPhone2AreaCode: data.EditPhone2AreaCode,
varPhone2PhoneNo: data.EditPhone2PhoneNo,
varFaxAreaCode: null,
varFaxPhoneNo: null,
varTollFreeAreaCode: data.EditTollFreeAreaCode,
varTollFreePhoneNo: data.EditTollFreePhoneNo,
varWebsite: data.EditWebsite,
varEmail: data.EditEmail,
varIsContacts: null,
varIsRelationship: null,
varIsOfficeLease: null,
varIsNotes: null,
varIsTagLists: null,
varIsResearch: null,
varSqFt: data.EditSqFt,
varIsEstimated: null,
varIsMonthToMonthLease: data.EditIsMonthToMonthLease,
varMoveDate: data.EditMoveDate,
varLeaseBeginMonth: data.EditLeaseBeginMonth,
varLeaseBeginYear: data.EditLeaseBeginYear,
varLeaseEndMonth: data.EditLeaseEndMonth,
varLeaseEndYear: data.EditLeaseEndYear,
varTeamUrl: null,
varLicompanyUrl: null
},
onFailure: function(error) {
stPostSuccess.setValue(false);
qryShowAlert.trigger({additionalScope : {varMessage: "Failed to update profile, the post was terminated.\n\nReturned error: " +
apiUpdateProfile.data.message}});
}
});

When I pull the JSON being sent to the API from 'state' it is as follows. You will notice that there are quite a few missing fields.
{
"DirMarketId": 0,
"Street": null,
"IsIntlBusiness": null,
"IsFaxIsPhone": null,
"IsOptedOut": null,
"IsOverride": null,
"IsMailOverride": null,
"AddressType": null,
"SuiteStatus": null,
"Msa": null,
"FollowUpDate": null,
"EnteredById": 501,
"EnteredDate": "2023-12-15T16:06:24.739Z",
"StreetNo": null,
"Naics": null,
"FaxAreaCode": null,
"FaxPhoneNo": null,
"IsContacts": null,
"IsRelationship": null,
"IsOfficeLease": null,
"IsNotes": null,
"IsTagLists": null,
"IsResearch": null,
"IsEstimated": null,
"TeamUrl": null,
"LicompanyUrl": null,
"BaseDate": null,
"DirCompanyId": 200535990,
"DirCompany": {
"DirCompanyId": 200535990,
"Name": "Company Name Here "
},
"ExtendedData": {
"delSuite": false,
"delBuildingNo": false,
"delMailSuite": false,
"delMailBuildingNo": false,
"delWebSite": false,
"delEmail": false,
"delMonthlyLease": false,
"delLeaseBegin": false,
"delLeaseEnd": false,
"delSIC": false,
"RelationshipParent": null,
"EditCorpHQ": null,
"EditCorpAddress": null,
"EditAffiliateOf": null,
"EditAffiliateAddress": null,
"delCorpHQ": false,
"delCorpAffilateOf": false,
"EditHqRelationshipParent": null,
"EditAfflRelationshipParent": null,
"ReviewedById": 501,
"ReviewedDate": "2023-12-15T16:06:24.743Z",
"BatchId": 32046,
"HasChanges": true
}
}

The API call errors because the JSON declaration is incomplete as expected. However, the onFailure doesn't fire. This all worked last week. In fact, the onFailure was firing earlier today, but it just stopped. I have cleared out everything and restarted a session. No change.

What can you tell me?

Hey @pushbtn, was great to meet you today during office hours. I know we spoke about some additional data gathering steps on your end. In the interim, could you also send over an app export and a sample row object? Would be helpful for me to try and replicate / understand what's happening here. Feel free to DM them to me here. Thanks!

Joe:

Sorry for the dupe but the first got rejected because I zipped the file.

Thank you for the help.

Attached is the exported App in JSON (zipped) and a file with a row of data (json), a copy of the same data for posting to API (suitable for Postman), the URL and a token that is only valid for today (12/22/2023).

If you look at this next week just ding me and I can update the token.

The contained data should be accepted on the PUT and return success. You can hit it as many times as you want with the same data, or change if you want to see an error returned.

I did do what Tess suggested, hardcoding the data points, and that worked. I have removed that code.

Right now it is just broken (Retool code). The 'state' of the API definition is not updating but it returns an update error.

Again I appreciate the help, I have been fighting with this for a couple of weeks and it evolves, what is broken today is different from yesterday, e.g., now it just fails without additional information. Any questions please let me know. BTW, this app has been under development on Retool for 2 years so it has a lot of legacy stuff in it.

(Attachment API_Data_Retool.txt is missing)

BWise%20Research%20App.json (1.04 MB)

1 Like

Thanks @pushbtn, the data isn't linked here. Might be best to send it directly on the forum if possible :grinning:

Txt files not allowed.

API_Data_Retool.json (7.38 KB)

@joeBumbaca did you get the data from the second send or are you still waiting for a response from me?

@pushbtn I was able to send requests using a stripped down version of the original JS query. All additionalScope variables were sent properly, and received a success response from the API.

Were you able to log the row object and / or set up an endpoint you control to see what is being sent?

Thank you for reviewing. I found the issue, I was referencing query.row.value[0] instead of query.data.value[0]. Somewhere along the line after multiple cut and pastes I overwrote the correct syntax. I apologize for burning your time.

1 Like