@@ -67,7 +67,7 @@ Column Names in Web API are all lower case using the <xref:Microsoft.Xrm.Sdk.Met
67
67
68
68
### HTTP methods
69
69
70
- Organization Data Service uses ` MERGE ` or ` PUT ` rather than ` PATCH ` .
70
+ Organization Data Service uses ` MERGE ` or ` PUT ` rather than ` PATCH ` to update a record .
71
71
72
72
### Data format
73
73
@@ -278,7 +278,7 @@ Preference-Applied: odata.maxpagesize=2
278
278
279
279
### Create records
280
280
281
- These examples show the differences between the Organization Data Service and the Web API when creating records.
281
+ These examples show the differences between the Organization Data Service and the Web API when creating records.
282
282
283
283
#### [ Organization Data Service] ( #tab/odatav2 )
284
284
@@ -335,6 +335,8 @@ REQ_ID: a0c614be-50be-4c1e-9413-1c7ba459c5c9
335
335
336
336
#### [ Web API] ( #tab/webapi )
337
337
338
+ The Web API example in this case uses the ` Prefer: return=representation ` request header which defines a behavior similar to the Organization Data Service behavior of returning ` 201 Created ` with the columns defined by the ` $select ` query option. Without this request header, Web API returns ` 201 No Content ` .
339
+
338
340
** Request**
339
341
340
342
``` http
@@ -408,13 +410,50 @@ These examples show the differences between the Organization Data Service and th
408
410
** Request**
409
411
410
412
``` http
411
-
413
+ GET https://crmue.api.crm.dynamics.com/XRMServices/2011/OrganizationData.svc/AccountSet(guid'b68d56a6-4739-ed11-9db0-002248296d7e')?$select=OwnershipCode,PrimaryContactId,OpenDeals_Date,Telephone1,NumberOfEmployees,Name,AccountNumber,DoNotPhone,IndustryCode HTTP/1.1
414
+ Accept: application/json
412
415
```
413
416
414
417
** Response**
415
418
416
419
``` http
420
+ HTTP/1.1 200 OK
417
421
422
+ {
423
+ "d": {
424
+ "__metadata": {
425
+ "uri": "https://crmue.api.crm.dynamics.com/xrmservices/2011/OrganizationData.svc/AccountSet(guid'b68d56a6-4739-ed11-9db0-002248296d7e')",
426
+ "type": "Microsoft.Crm.Sdk.Data.Services.Account"
427
+ },
428
+ "OwnershipCode": {
429
+ "__metadata": {
430
+ "type": "Microsoft.Crm.Sdk.Data.Services.OptionSetValue"
431
+ },
432
+ "Value": 2
433
+ },
434
+ "PrimaryContactId": {
435
+ "__metadata": {
436
+ "type": "Microsoft.Crm.Sdk.Data.Services.EntityReference"
437
+ },
438
+ "Id": "dff27d1f-a61b-4bfe-a203-b2e5a36cda0e",
439
+ "LogicalName": "contact",
440
+ "Name": "Sam Smith",
441
+ "RowVersion": null
442
+ },
443
+ "OpenDeals_Date": "/Date(1663784098000)/",
444
+ "Telephone1": "555-1234",
445
+ "NumberOfEmployees": 500,
446
+ "Name": "Contoso, Ltd. (sample)",
447
+ "AccountNumber": "12227",
448
+ "DoNotPhone": true,
449
+ "IndustryCode": {
450
+ "__metadata": {
451
+ "type": "Microsoft.Crm.Sdk.Data.Services.OptionSetValue"
452
+ },
453
+ "Value": 7
454
+ }
455
+ }
456
+ }
418
457
419
458
```
420
459
@@ -423,13 +462,48 @@ These examples show the differences between the Organization Data Service and th
423
462
** Request**
424
463
425
464
``` http
426
-
465
+ GET https://crmue.api.crm.dynamics.com/api/data/v9.2/accounts(b68d56a6-4739-ed11-9db0-002248296d7e)?$select=ownershipcode,_primarycontactid_value,opendeals_date,customersizecode,telephone1,numberofemployees,name,accountnumber,donotphone,industrycode HTTP/1.1
466
+ Prefer: odata.include-annotations="*"
467
+ Prefer: return=representation
468
+ OData-MaxVersion: 4.0
469
+ OData-Version: 4.0
470
+ If-None-Match: null
471
+ Accept: application/json
427
472
```
428
473
429
474
** Response**
430
475
431
476
``` http
477
+ HTTP/1.1 200 OK
478
+ Content-Type: application/json; odata.metadata=minimal
479
+ ETag: W/"73921464"
480
+ OData-Version: 4.0
481
+ Preference-Applied: odata.include-annotations="*"
432
482
483
+ {
484
+ "@odata.context": "https://crmue.api.crm.dynamics.com/api/data/v9.2/$metadata#accounts(ownershipcode,_primarycontactid_value,opendeals_date,customersizecode,telephone1,numberofemployees,name,accountnumber,donotphone,industrycode)/$entity",
485
+ "@odata.etag": "W/\"73921464\"",
486
+
487
+ "ownershipcode": 2,
488
+ "_primarycontactid_value@OData.Community.Display.V1.FormattedValue": "Sam Smith",
489
+ "_primarycontactid_value@Microsoft.Dynamics.CRM.associatednavigationproperty": "primarycontactid",
490
+
491
+ "_primarycontactid_value": "dff27d1f-a61b-4bfe-a203-b2e5a36cda0e",
492
+ "[email protected] ": "9/21/2022 11:14 AM",
493
+ "opendeals_date": "2022-09-21T18:14:58Z",
494
+ "[email protected] ": "Default Value",
495
+ "customersizecode": 1,
496
+ "telephone1": "555-1234",
497
+
498
+ "numberofemployees": 500,
499
+ "name": "Contoso, Ltd. (sample)",
500
+ "accountnumber": "12227",
501
+ "[email protected] ": "Do Not Allow",
502
+ "donotphone": true,
503
+ "[email protected] ": "Consulting",
504
+ "industrycode": 7,
505
+ "accountid": "b68d56a6-4739-ed11-9db0-002248296d7e"
506
+ }
433
507
434
508
```
435
509
@@ -444,13 +518,34 @@ These examples show the differences between the Organization Data Service and th
444
518
** Request**
445
519
446
520
``` http
521
+ POST https://crmue.api.crm.dynamics.com/XRMServices/2011/OrganizationData.svc/AccountSet(guid'b68d56a6-4739-ed11-9db0-002248296d7e') HTTP/1.1
522
+ Accept: application/json
523
+ X-HTTP-Method: MERGE
524
+ Content-Type: application/json
447
525
526
+ {
527
+ "OwnershipCode": {
528
+ "Value": 3
529
+ },
530
+ "PrimaryContactId": {
531
+ "Id": "6db0be2e-d01c-ed11-b83e-000d3a572421"
532
+ },
533
+ "OpenDeals_Date": "12/26/2022",
534
+ "Telephone1": "555-1235",
535
+ "NumberOfEmployees": 501,
536
+ "Name": "Contoso, Ltd.",
537
+ "AccountNumber": "12228",
538
+ "DoNotPhone": false,
539
+ "IndustryCode": {
540
+ "Value": 6
541
+ }
542
+ }
448
543
```
449
544
450
545
** Response**
451
546
452
547
``` http
453
-
548
+ HTTP/1.1 204 No Content
454
549
455
550
```
456
551
@@ -459,14 +554,33 @@ These examples show the differences between the Organization Data Service and th
459
554
** Request**
460
555
461
556
``` http
557
+ PATCH https://crmue.api.crm.dynamics.com/api/data/v9.2/accounts(b68d56a6-4739-ed11-9db0-002248296d7e) HTTP/1.1
558
+ OData-MaxVersion: 4.0
559
+ OData-Version: 4.0
560
+ If-None-Match: null
561
+ Accept: application/json
562
+ Content-Type: application/json
563
+
564
+ {
565
+ "ownershipcode": 3,
566
+ "[email protected] ":"/contacts(6db0be2e-d01c-ed11-b83e-000d3a572421)",
567
+ "opendeals_date": "2022-12-26T00:00:00Z",
568
+ "telephone1":"555-1235",
569
+ "numberofemployees": 501,
570
+ "name":"Contoso, Ltd.",
571
+ "accountnumber": "12229",
572
+ "donotphone": false,
573
+ "industrycode": 6
574
+ }
462
575
463
576
```
464
577
465
578
** Response**
466
579
467
580
``` http
468
-
469
-
581
+ HTTP/1.1 204 No Content
582
+ OData-Version: 4.0
583
+ OData-EntityId: https://crmue.api.crm.dynamics.com/api/data/v9.2/accounts(b68d56a6-4739-ed11-9db0-002248296d7e)
470
584
```
471
585
472
586
---
@@ -480,29 +594,33 @@ These examples show the differences between the Organization Data Service and th
480
594
** Request**
481
595
482
596
``` http
483
-
597
+ DELETE https://crmue.api.crm.dynamics.com/XRMServices/2011/OrganizationData.svc/AccountSet(guid'b68d56a6-4739-ed11-9db0-002248296d7e') HTTP/1.1
598
+ Accept: application/json
484
599
```
485
600
486
601
** Response**
487
602
488
603
``` http
489
-
490
-
604
+ HTTP/1.1 204 No Content
491
605
```
492
606
493
607
#### [ Web API] ( #tab/webapi )
494
608
495
609
** Request**
496
610
497
611
``` http
498
-
612
+ DELETE https://crmue.api.crm.dynamics.com/api/data/v9.2/accounts(b68d56a6-4739-ed11-9db0-002248296d7e) HTTP/1.1
613
+ OData-MaxVersion: 4.0
614
+ OData-Version: 4.0
615
+ If-None-Match: null
616
+ Accept: application/json
499
617
```
500
618
501
619
** Response**
502
620
503
621
``` http
504
-
505
-
622
+ HTTP/1.1 204 No Content
623
+ OData-Version: 4.0
506
624
```
507
625
508
626
---
0 commit comments