How to use API in NAV2018?

Emaz
Member Posts: 18
Hi,
I want to use the ZPL Web Service (RESTful API) in NAV2018.
My aim is to send a ZPL-Code and get back a png.
I tried diffrent ways, but failed.
I Always get diffrent Error-Messages. To post them would make no sense...
I tried it with two funktions.
First (using Codeunit 1297)
Second Using DotNet (but it is almost the same as before)
Any helpful hints or codeexamples?
Thanks and best regards
Emaz
I want to use the ZPL Web Service (RESTful API) in NAV2018.
My aim is to send a ZPL-Code and get back a png.
I tried diffrent ways, but failed.
I Always get diffrent Error-Messages. To post them would make no sense...
I tried it with two funktions.
First (using Codeunit 1297)
Second Using DotNet (but it is almost the same as before)
Any helpful hints or codeexamples?
Thanks and best regards
Emaz
0
Answers
-
Hi, don't know your service, but this is an example using cu1290:
LOCAL [TryFunction] TryEncodeQR(pRawText : Text;pQRSize : Integer;VAR pvQRCode : TEMPORARY Record TempBlob SECURITYFILTERING(Ignored)) lSOAPWebServiceRequestMgt.BuildWebRequestMethod(pRawText, 'GET', lXMLWebRequest); //where pRawText is Address with params lXMLHttpResponse := lXMLWebRequest.GetResponse; lInStream := lXMLHttpResponse.GetResponseStream; pvQRCode.Blob.CREATEOUTSTREAM(lOutStream); COPYSTREAM(lOutStream, lInStream);
Regards
xStepa0 -
Hi,
thank you, but I find my mistake.URL := 'http://api.labelary.com/v1/printers/12dpmm/labels/4x6/0/'; HttpWebRequestMgt.Initialize(URL); HttpWebRequestMgt.DisableUI; HttpWebRequestMgt.SetMethod('POST'); HttpWebRequestMgt.SetReturnType('image/png'); HttpWebRequestMgt.SetContentType('application/x-www-form-urlencoded'); HttpWebRequestMgt.SetExpect(FALSE); HttpWebRequestMgt.AddBodyAsText(ZPL); TempBlob.INIT; TempBlob.Blob.CREATEINSTREAM(InStr); IF HttpWebRequestMgt.GetResponse(InStr,HttpStatusCode,ResponseHeaders) THEN BEGIN IF LabelHeader.GET(LabelCode) THEN BEGIN LabelHeader.Label := TempBlob.Blob; LabelHeader.MODIFY; END; END ELSE MESSAGE(ErrorMsg);
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions