It's possible to publish an Odata webservice with json complex structure on Nav 2013 R2?

pereiranuno88pereiranuno88 Member Posts: 6
edited 2020-03-11 in NAV Tips & Tricks
I wanted to share a structure with elements, for example sales documents with lines.
I tried do a page with subpart element but with not sucess.

I only obtain headers.

{
"odata.metadata": "http://server:port/bd/OData/$metadata#Sales",
"value": [
{
"Document_Type": "Invoice",
"No": "VTFR012000001",
"Sell_to_Customer_No": "00596",
"ETag": "60;JAAAAACLAgAAAAJ7/1YAVABGAFIAMAAxADIAMAAwADAAMAAwADEAAAAAAA==10;21500026350;"
},
{
"Document_Type": "Invoice",
"No": "VTFR1092000021",
"Sell_to_Customer_No": "00003",
"ETag": "60;JAAAAACLAgAAAAJ7/1YAVABGAFIAMQAwADkAMgAwADAAMAAwADIAMQAAAAAA10;21496498140;"
},

Answers

  • ftorneroftornero Member Posts: 522
    Hello @pereiranuno88,

    That's the way the ODATA works, but you must get too a reference to the lines in the page that you need to call again to obtain these lines

    Something like this with the Page 42 from Postman:

    oxwwvh8xvke1.png

    Maybe the best thing is create a Query with the tables that you need and publish it like a web service.

    Regards
  • pereiranuno88pereiranuno88 Member Posts: 6
    edited 2020-03-18
    ftornero wrote: »
    Hello @pereiranuno88,

    That's the way the ODATA works, but you must get too a reference to the lines in the page that you need to call again to obtain these lines

    Something like this with the Page 42 from Postman:

    oxwwvh8xvke1.png

    Maybe the best thing is create a Query with the tables that you need and publish it like a web service.

    Regards

    Hello @ftornero ,

    Thank you very much for the answer. I will see this with more detail. For a WS to create SalesOrder On Nav 2013 R2 you recomend use Odata or SOAP?

    Regards
  • ftorneroftornero Member Posts: 522
    Hello @pereiranuno88,

    I am using SOAP and a XMLPort in a similar scenario, but I am writing first the Input Order in two new tables (header and lines) and later on from these tables I create the Sales Order.

    Regards
  • pereiranuno88pereiranuno88 Member Posts: 6
    ftornero wrote: »
    Hello @pereiranuno88,

    I am using SOAP and a XMLPort in a similar scenario, but I am writing first the Input Order in two new tables (header and lines) and later on from these tables I create the Sales Order.

    Regards

    Thank you @ftornero .


  • pereiranuno88pereiranuno88 Member Posts: 6
    ftornero wrote: »
    Hello @pereiranuno88,

    That's the way the ODATA works, but you must get too a reference to the lines in the page that you need to call again to obtain these lines

    Something like this with the Page 42 from Postman:

    oxwwvh8xvke1.png

    Maybe the best thing is create a Query with the tables that you need and publish it like a web service.

    Regards
    ftornero wrote: »
    Hello @pereiranuno88,

    That's the way the ODATA works, but you must get too a reference to the lines in the page that you need to call again to obtain these lines

    Something like this with the Page 42 from Postman:

    oxwwvh8xvke1.png

    Maybe the best thing is create a Query with the tables that you need and publish it like a web service.

    Regards

    Hello @ftornero

    I trie using the referente to get the lines like you said, but i obtain the above error.

    5rpbfdkqzf1r.png


    txkhoxldheku.png

  • ftorneroftornero Member Posts: 522
    Hello @pereiranuno88,

    I did the test with Powershell and it works, could you post the code you are using ?

    Regards
  • pereiranuno88pereiranuno88 Member Posts: 6
    edited 2020-03-26

    Hello @ftornero ,

    I already did, in another environment. I must have some cumulative update for update.

    kbazs73c8c37.png



    Thank you very much!
    Kind regards
Sign In or Register to comment.