muxinc / strapi-plugin-mux-video-uploader

A Strapi plugin for managing uploads to Mux.
https://mux.com
23 stars 16 forks source link

PUT API not working for MUX assets collection #44

Closed aagamLF closed 1 year ago

aagamLF commented 1 year ago

Hi,

We have encountered an issue with the PUT API call to update MUX asset collection. The API response is 200 OK but the corresponding record is not getting updated as expected.

API cURL curl --location --request PUT 'https://{hosted-strapi-URL}/mux-video-uploader/mux-asset/22' \ --header 'Authorization: Bearer ey....' \ --header 'Content-Type: application/json' \ --data-raw '{ "initUploadFacility": 10 }'

Expected Response initUploadFacility updated to 10

{ "id": 22, "title": "Video 1", "upload_id": "ns4m....", "asset_id": "tc6k...", "playback_id": "mj6e...", "error_message": null, "isReady": true, "maxStoredResolution": null, "maxStoredFrameRate": null, "aspectRatio": "16:9", "maxWidth": null, "maxHeight": null, "initUploadFacility": 10, "createdAt": "2022-08-03T17:03:04.076Z", "updatedAt": "2022-08-05T15:26:10.285Z", "duration": 500.0 }

Actual Response initUploadFacility still remains null { "id": 22, "title": "Video 1", "upload_id": "ns4m....", "asset_id": "tc6k...", "playback_id": "mj6e...", "error_message": null, "isReady": true, "maxStoredResolution": null, "maxStoredFrameRate": null, "aspectRatio": "16:9", "maxWidth": null, "maxHeight": null, "initUploadFacility": null, "createdAt": "2022-08-03T17:03:04.076Z", "updatedAt": "2022-08-05T15:26:10.285Z", "duration": 500.0 }

New data points have been added to the default MUX assets collection as shown below:

image

Environment

erikpena commented 1 year ago

Hello @aagamLF, great to hear from you again! Based on this issue, we would not want to introduce a change to look for non-native fields to the mux-asset collection type.

For what it's worth, I understand what you're trying to do (extend the metadata for mux-asset). I think if I were to make any sort of recommendation for a workaround, it would be to not change the mux-asset collection type. Rather, create a new collection type that has a relationship to mux-asset and that includes the new metadata you're interested in setting. This effectively wraps the mux-asset collection type with a new collection type that contains whatever you want.

Let me know if any of this is unclear and we can talk further about the above and assist in collaborating on a resolution. Thank you!