最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

AX RTW – My ODATA and JSON journey – Part I

网络文摘 William 1952浏览 0评论

Learn the word; ODATA. We will hear a lot of ODATA in the future, because it will change the way we integrate and how we exchange information between AX and other systems. A good starting point is the AX help wiki, that Kuntal Mehta created. I have decided to explore what the ODATA can do, and wanted to write a bit about my journey. Instead of trying to explain all technical details of data entities and how the architecture is, then let us rather just test something J

What you need to test what I’m doing is

  1. An AX RTW environment deployed from LCS
  2. Internet explorer
  3. Good old notepad

Step1: What services is available?

To get all entities available to you use your Site address, and add “/data” at the end.

Then save the file you receive, and open it in notepad. (I have associated *.json with notepad). The file you get looks like this:

Each line here represents a data entity service we can use. The format of this is the JSON format, but that is not important now.

Step2: Show me the customers

In the file you may find that there is an entity/schema named “Customers“. I can therefore just add the “/data/Customers” to my URL

And then I get a JSON file of all the customers;

But this is a bit “cloudy” and I can further filer down what I want. Let’s say I just want to see all customer names. I can then add “/data/Customers/?$select=Name” to my URL

Now it returns a JSON file with only the Name.

If I wanted to add one more column, like the Payment terms, the syntax would look like “/data/Customers/?$select=Name,PaymentTerms“, but this would not work because the comma cannot be used on a URL. I therefore need to replace the comma with %2C, that is the URL representation of comma. For multiple columns I therefore add “/data/Customers/?$select=Name%2CPaymentTerms

You see some strange “@data.etag”, and here is an explanation. It is for caching.

Step3: Can I read this in Excel?

Yes. Excel can import OData, and format it like we would.

Then fill in the /data URL, select schema, and then select fields.

And then you may read directly into Excel all entities made available in AX RTW, even without the AX connector.

Step5: Show me all !

Sure. Try to add the “/data/$metadata“, and AX return All schemas, fields and relations. It take a long time, but nice to explore.

Step6: Can we use DIXF to import directly from OData feeds ?

This is what I would love to see. But I have not found it yet.

Happy DAX’ing ;-)


发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址