API endpoint intricacies

Product: PowerShell Universal
Version: 5.0.14

@adam I’m submitting this here since I don’t know where else to put it - it’s primarily a request for more information on how to best utilize our endpoints.

  1. We have multiple data sources submitting CSV data to endpoints we’ve defined. In some of those cases, our handlers can use -InFile to submit the file with IWR, but in one case, we are going to retrieve the byte[] of the file within a script before submitting to that same endpoint. Can we directly submit the byte[] of the file to the -Body param of IWR and expect the same behavior, being able to parse $Data in the endpoint’s code? If not, what’s the best way to ensure similar behavior?
  2. Is there a way to early-return an endpoint while still processing the rest of the code without invoking an external script? The aforementioned endpoint causes one of our data sources to timeout due to its own unchangeable timeout as the CSV is quite large, and we have an alternate method of submitting errors to that source without requiring the output to necessarily come from the New-PSUApiResponse cmdlet.

Thanks in advance!
:wavy_dash:ZG

  1. Yes.
  2. No. Had to create an additional endpoint that invokes a script to invoke the final endpoint.