Full width home advertisement

Post Page Advertisement [Top]

You can use POSTMAN or FIDDLER for any of the testing. I personally like POSTMAN.


I assume that you have already gone through pages on READ operations. If not, please go through all that for better understanding of upcoming discussion on CREATE,UPDATE and DELETE operations in Dynamics 365 for operations(D365O).

Reading through data entities was fun, isn't it. But as a developer you must be willing to do more than just reading the data using Data entities.

Microsoft has done commendable work in whole data entity framework in D365O, it now can be used as point of entry for other operations such as create, update and delete. This a big relief considering AIF is practically a history for D365O.

Although there are other ways also to deal with data inside D365O, I find using Data entities the easiest.

I have created a custom table named 'BeaconService' for my testing purpose.

1. CREATE operations:

In Odata terminology, D365 CREATE operation can be referred as POST operation. Yes, you are right, that means you have to setup a method type to POST.

URL would look like this

https://*******devaos.cloudax.dynamics.com/data/Beaconservice

Set the Authorization code prefixed by 'bearer'

Then Set the body, keeping mandatory fields like BeaconID(in my case) and dataareaId as shown below.
?
1
2
3
4
5
6
7
8
9
10
11
12
{
      "EndTime": 0,
      "BeaconNum": "DA:AF:A9:FD:Y6:T4",
      "OfferId": "ST100006",
      "Description": "25% flat discount for your amazing audio experience",
      "EffectiveDate": "2015-12-25T12:00:00Z",
      "StartTime": 0,
      "dataAreaId": "usrt",
      "Category": "Headphones",
      "Offer": "headphones on discounted rate",
      "Brand": "Sony"
}
?
1
 
?
1
 

Now execute it (click on Send button if using POSTMAN).
This will give same output on the postman and error if any. Now you can go to the database or D365 screen to see the data.

2. UPDATE Operations

In Odata terminology, D365 UPDATE operation can be referred as PATCH operation.
i.e., you have to setup method type as PATCH.

URL would look like this
https://*******devaos.cloudax.dynamics.com/data/Beaconservice(BeaconNum='DA:AF:A9:FD:Y6:T4',dataAreaId='usrt')

Difference in the URL as you can see is, you'll have to include your primary key along with datareaid.

Now, Set the Authorization code prefixed by 'bearer'

Then Set the body as below, here you do not have to include primary keys
?
1
2
3
{
    "Category": "Earphones"
}
?
1
 

Now execute it (click on Send button if using POSTMAN).
This will leave the output screen blank if succeeded and error if any. Go ahead and verify the data.

3. DELETE Operations

In Odata terminology, D365 UPDATE operation can be referred as DELETE operation.
i.e., you have to setup method type as DELETE.

URL would look like this
https://*******devaos.cloudax.dynamics.com/data/Beaconservice(BeaconNum='DA:AF:A9:FD:Y6:T4',dataAreaId='usrt')

Here also, you'll have to include your primary key along with datareaid.

Now, Set the Authorization code prefixed by 'bearer'

Leave the body blank here. 
?
1
 

Then execute it (click on Send button if using POSTMAN).
This will leave the output screen blank if succeeded and error if any.

1 komentar:

Bottom Ad [Post Page]