Using UpdateOption NoReplace

Hello,

We're trying to use the NoReplace option when sending batch and it doesn't work. For a single timeseries it does work. For example, the following URL, does work from postman:

https://piserver/piwebapi/streams/F1DPUpybrj1AHkOSeTdNPi93FAI7cAAARURNUElEMVxLQ0hfUEhfR0VOX01XXzQwLk9WRVJSSURF/recorded?UpdateOption=NoReplace

 

But, when we try to send a batch, the NoReplace is ignored:

        "0":

               {

                               "Method":"POST",

               "Resource":https://piserver/piwebapi/streams/F1DPUpybrj1AHkOSeTdNPi93FAI7cAAARURNUElEMVxLQ0hfUEhfR0VOX01XXzQwLk9WRVJSSURF/recorded?UpdateOption=NoReplace,

                               "Content":"[

                               {\u0022Timestamp\u0022:\u00222025-06-10T12:00:00.0000000\u0022,

                               \u0022Good\u0022:true,

                               \u0022Questionable\u0022:false,

                               \u0022Value\u0022:\u002225\u0022

                               }]"

                               }

               }

 

The code that create the batch is:

 

var batchRequest = new Dictionary<string, BatchSubRequest>();
 foreach (var item in requestModel.Select((Item, Index) => new { Item, Index }))
 {
         if (item.Item.Errors != null && item.Item.Errors?.Count > 0)  continue;
         string url = baseUrl + $"streams/{item.Item.WebId}/recorded?UpdateOption={updateOption}";
          var request = new BatchSubRequest()
           {
               Method = "POST",
               Resource = url,
                Content = JsonSerializer.Serialize(item.Item.Items, new JsonSerializerOptions
                 {
                     DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
                      PropertyNameCaseInsensitive = true
                  })
             };
            batchRequest.Add(item.Index.ToString(), request);
  }

 var batchResp = await BatchRequest(new BatchRequestModel() { Requests = batchRequest });
…

internal async Task<IDictionary<int, BatchSubResponse>> BatchRequest(BatchRequestModel requestModel)
{
   try
   {
      var client = _httpClientFactory.CreateClient();
      string url = baseUrl + @"batch";
      var requestData = JsonSerializer.Serialize(requestModel.Requests, new JsonSerializerOptions 
       { 
           DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, 
            PropertyNameCaseInsensitive = true 
        });

       HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Post, url);
       httpRequest.Content = new StringContent(requestData, Encoding.UTF8, "application/json");
       HttpResponseMessage httpResponse = await client.SendAsync(httpRequest);
       httpResponse.EnsureSuccessStatusCode();
       string response = await httpResponse.Content.ReadAsStringAsync();

Thank you,

Ken