Skip to content

Commit 506ecef

Browse files
adding support for Content-ID in associate and associateSingleValued requests. fixes #190
1 parent ab2d315 commit 506ecef

20 files changed

+525
-126
lines changed

.github/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ async | `boolean` | All | **XHR requests only!** Indicates whether the requests
364364
backgroundOperationCallbackUrl | `string` | `callAction` | `v2.3.0+` Background operation callback URL. [More Info](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/background-operations?tabs=webapi#request-a-callback)
365365
bypassCustomPluginExecution | `boolean` | `create`, `update`, `upsert`, `delete` | If set to true, the request bypasses custom business logic, all synchronous plug-ins and real-time workflows are disabled. Check for special exceptions in Microsft Docs. [More Info](https://docs.microsoft.com/en-us/powerapps/developer/data-platform/bypass-custom-business-logic)
366366
collection | `string` | All | Entity Collection name.
367-
contentId | `string` | `create`, `update`, `upsert`, `deleteRecord` | **BATCH REQUESTS ONLY!** Sets Content-ID header or references request in a Change Set. [More Info](https://www.odata.org/documentation/odata-version-3-0/batch-processing/)
367+
contentId | `string` | `create`, `update`, `upsert`, `deleteRecord`, `associate`, `associateSingleValued` | **BATCH REQUESTS ONLY!** Sets Content-ID header or references request in a Change Set. [More Info](https://www.odata.org/documentation/odata-version-3-0/batch-processing/)
368368
continueOnError | `boolean` | `executeBatch` | **BATCH REQUESTS ONLY!** Sets Prefer header to `odata.continue-on-error` that allows more requests be processed when errors occur. The batch request will return `200 OK` and individual response errors will be returned in the batch response body. [More Info](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/execute-batch-operations-using-web-api#handling-errors)
369369
count | `boolean` | `retrieveMultiple`, `retrieveAll` | Boolean that sets the $count system query option with a value of true to include a count of entities that match the filter criteria up to 5000 (per page). Do not use $top with $count!
370370
data | `Object` or `ArrayBuffer` / `Buffer` (for node.js) | `create`, `update`, `upsert`, `uploadFile` | A JavaScript object that represents Dynamics 365 entity, action, metadata and etc.
@@ -2862,7 +2862,7 @@ the config option "formatted" will enable developers to retrieve all information
28622862
- [X] Support Microsoft Power Pages. `Added in v2.1.0`
28632863
- [X] Background Operations for custom actions. `Added in v2.3.0`
28642864
- [X] Support Search API 2.0 [#174](https://github.com/AleksandrRogov/DynamicsWebApi/issues/174). `Added in v2.3.0`
2865-
- [ ] [Session token](https://learn.microsoft.com/en-ca/power-apps/developer/data-platform/use-elastic-tables?tabs=webapi#work-with-the-session-token) support. `Coming in v2.3.1`
2865+
- [ ] [Session token](https://learn.microsoft.com/en-ca/power-apps/developer/data-platform/use-elastic-tables?tabs=webapi#work-with-the-session-token) support. `Coming in v2.3.2`
28662866
- [ ] Custom requests.
28672867

28682868
Many more features to come!

dist/browser/esm/dynamics-web-api.js

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser/esm/dynamics-web-api.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/dynamics-web-api.js

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/dynamics-web-api.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dynamics-web-api.d.ts

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! dynamics-web-api v2.3.0 (c) 2025 Aleksandr Rogov. License: MIT */
1+
/*! dynamics-web-api v2.3.1 (c) 2025 Aleksandr Rogov. License: MIT */
22
/**
33
* Microsoft Dataverse Web API helper library for Node.js and Browser.
44
* It is compatible with: Dataverse, Dynamics 365 (online), Dynamics 365 (on-premise), Dynamics CRM 2016, Dynamics CRM Online.
@@ -463,7 +463,10 @@ export interface Request extends BaseRequest {
463463
collection?: string;
464464
}
465465
export interface CRUDRequest extends Request {
466-
/**A String representing collection record's Primary Key (GUID) or Alternate Key(s). */
466+
/**
467+
* A String representing collection record's Primary Key (GUID) or Alternate Key(s).
468+
* Can be ommitted in a Batch request when contentId is set.
469+
*/
467470
key?: string;
468471
}
469472
export interface CountRequest extends Request {
@@ -637,24 +640,40 @@ export interface RetrieveMultipleRequest extends Request {
637640
partitionId?: string;
638641
}
639642
export interface AssociateRequest extends Request {
640-
/**Primary entity record id/key. */
641-
primaryKey: string;
643+
/**
644+
* Primary entity record id/key.
645+
* Can be ommitted in a Batch request when contentId is set.
646+
*/
647+
primaryKey?: string;
642648
/**Relationship name. */
643649
relationshipName: string;
644-
/**Related name of the Entity Collection or Entity Logical name. */
645-
relatedCollection: string;
646-
/**Related entity record id/key. */
650+
/**
651+
* Related name of the Entity Collection or Entity Logical name.
652+
* Can be omitted in a Batch request when relatedKey is set to a ContentId.
653+
*/
654+
relatedCollection?: string;
655+
/**Related entity record id/key or a ContentId in a Batch request (e.g. $2). */
647656
relatedKey: string;
657+
/**v2.3.1+ BATCH REQUESTS ONLY! Sets Content-ID header or references request in a Change Set. */
658+
contentId?: string;
648659
}
649660
export interface AssociateSingleValuedRequest extends Request {
650-
/**Primary entity record id/key. */
651-
primaryKey: string;
661+
/**
662+
* Primary entity record id/key.
663+
* Can be ommitted in a Batch request when contentId is set.
664+
*/
665+
primaryKey?: string;
652666
/**Navigation property name. */
653667
navigationProperty: string;
654-
/**Related name of the Entity Collection or Entity Logical name. */
655-
relatedCollection: string;
656-
/**Related entity record id/key. */
668+
/**
669+
* Related name of the Entity Collection or Entity Logical name.
670+
* Can be omitted in a Batch request when relatedKey is set to a ContentId.
671+
*/
672+
relatedCollection?: string;
673+
/**Related entity record id/key or a ContentId in a Batch request (e.g. $2). */
657674
relatedKey: string;
675+
/**v2.3.1+ BATCH REQUESTS ONLY! Sets Content-ID header or references request in a Change Set. */
676+
contentId?: string;
658677
}
659678
export interface DisassociateRequest extends Request {
660679
/**Primary entity record id/key. */

dist/dynamics-web-api.js

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)