Table of Contents

Class BatchDnsRecordsRequest

Namespace
Cloudflare.NET.Dns.Models
Assembly
Cloudflare.NET.dll

Request to perform batch DNS record operations in a single API call.

Execution Order: Deletes → Patches → Puts → Posts. This order ensures that deletions happen first, allowing re-creation of records with the same name in the same batch.

public record BatchDnsRecordsRequest : IEquatable<BatchDnsRecordsRequest>
Inheritance
BatchDnsRecordsRequest
Implements
Inherited Members

Examples

// Batch: delete one record, update another, create two new ones
var batch = new BatchDnsRecordsRequest(
  Deletes: [new BatchDeleteOperation("record-id-to-delete")],
  Patches: [new BatchPatchOperation("record-id-to-update", Content: "192.0.2.100")],
  Posts: [
    new CreateDnsRecordRequest(DnsRecordType.A, "new.example.com", "192.0.2.1"),
    new CreateDnsRecordRequest(DnsRecordType.A, "new2.example.com", "192.0.2.2")
  ]
);
var result = await dns.BatchDnsRecordsAsync(zoneId, batch);

Constructors

BatchDnsRecordsRequest(IReadOnlyList<BatchDeleteOperation>?, IReadOnlyList<BatchPatchOperation>?, IReadOnlyList<BatchPutOperation>?, IReadOnlyList<CreateDnsRecordRequest>?)

Request to perform batch DNS record operations in a single API call.

Execution Order: Deletes → Patches → Puts → Posts. This order ensures that deletions happen first, allowing re-creation of records with the same name in the same batch.

public BatchDnsRecordsRequest(IReadOnlyList<BatchDeleteOperation>? Deletes = null, IReadOnlyList<BatchPatchOperation>? Patches = null, IReadOnlyList<BatchPutOperation>? Puts = null, IReadOnlyList<CreateDnsRecordRequest>? Posts = null)

Parameters

Deletes IReadOnlyList<BatchDeleteOperation>

Records to delete (by ID). Executed first.

Patches IReadOnlyList<BatchPatchOperation>

Records to partially update (PATCH). Executed second.

Puts IReadOnlyList<BatchPutOperation>

Records to fully replace (PUT). Executed third.

Posts IReadOnlyList<CreateDnsRecordRequest>

Records to create (POST). Executed last.

Examples

// Batch: delete one record, update another, create two new ones
var batch = new BatchDnsRecordsRequest(
  Deletes: [new BatchDeleteOperation("record-id-to-delete")],
  Patches: [new BatchPatchOperation("record-id-to-update", Content: "192.0.2.100")],
  Posts: [
    new CreateDnsRecordRequest(DnsRecordType.A, "new.example.com", "192.0.2.1"),
    new CreateDnsRecordRequest(DnsRecordType.A, "new2.example.com", "192.0.2.2")
  ]
);
var result = await dns.BatchDnsRecordsAsync(zoneId, batch);
See Also

Properties

Deletes

Records to delete (by ID). Executed first.

[JsonPropertyName("deletes")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<BatchDeleteOperation>? Deletes { get; init; }

Property Value

IReadOnlyList<BatchDeleteOperation>

Patches

Records to partially update (PATCH). Executed second.

[JsonPropertyName("patches")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<BatchPatchOperation>? Patches { get; init; }

Property Value

IReadOnlyList<BatchPatchOperation>

Posts

Records to create (POST). Executed last.

[JsonPropertyName("posts")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<CreateDnsRecordRequest>? Posts { get; init; }

Property Value

IReadOnlyList<CreateDnsRecordRequest>

Puts

Records to fully replace (PUT). Executed third.

[JsonPropertyName("puts")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<BatchPutOperation>? Puts { get; init; }

Property Value

IReadOnlyList<BatchPutOperation>

See Also