Incorrect format for 'records' parameter in DeleteRecordsAsync #58

Closed
opened 2018-07-19 09:55:16 -04:00 by etfrenchvcu · 1 comment
etfrenchvcu commented 2018-07-19 09:55:16 -04:00 (Migrated from github.com)

When calling DeleteRecordsAsync, I receive the following error message:
Incorrect format for 'records' parameter. It must be passed as an array, even if it only contains a single record name.
I think we're passing the REDCap API an invalid records parameter by converting the string[] records parameter to a string. I think we could fix it by adding each record in the records array to the payload as an item in an array.

Instead of
payload.Add("records", await this.ConvertArraytoString(records));

We could do the following, which would successfully delete the records.

for (var i = 0; i< records.Length; i++)
{
  payload.Add($"records[{i}]", records[i]);
}
When calling DeleteRecordsAsync, I receive the following error message: `Incorrect format for 'records' parameter. It must be passed as an array, even if it only contains a single record name.` I think we're passing the REDCap API an invalid `records` parameter by converting the `string[] records` parameter to a string. I think we could fix it by adding each record in the `records` array to the `payload` as an item in an array. Instead of `payload.Add("records", await this.ConvertArraytoString(records));` We could do the following, which would successfully delete the records. ``` for (var i = 0; i< records.Length; i++) { payload.Add($"records[{i}]", records[i]); } ```
tranpl commented 2018-07-24 12:56:01 -04:00 (Migrated from github.com)

thanks @etfrenchvcu , updated with fix

thanks @etfrenchvcu , updated with fix
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
tranpl/redcap-api#58
No description provided.