Connect Navision with Shopware with WinHttp to REST-Api

rthsw
Member Posts: 73
Hi, i want to send Items and more to the Shopware using the REST-Api. So i think the easiest way is to connect over WinHttp. But how? I get no connection to the api. Does someone has a cool (or hot) Tip for me?
I started with this code (found the basics on the shopware forum from DonAlfredo)
CREATE(WinHttp);
WinHttp.Open('GET','http://Niederxxxxxhop.de/api');
WinHttp.SetCredentials('ds','mTuzLxxxXXXXxxxXXXXxxxxXXXXxxxXXXnwJnt','');
WinHttp.Send('articles');
ResponseStream := WinHttp.ResponseStream;
ResponseBuffer.READ(ResponseStream);
ResponseFile.WRITEMODE(TRUE);
ResponseFile.CREATE('C:\Temp\Webshop.txt');
ResponseFile.CREATEOUTSTREAM(FileStream);
ResponseBuffer.WRITE(FileStream);
ResponseFile.CLOSE;
But the only reaction is already at the SetCredentials: (translated by myself, hope good enough)
The Call of the member SetCredentials is failed. WinHttp.WinHttpRequest returns this Message: The URL uses no known Protocoll.
So i think i need to add the Shop-url also in the credentials, but how? ](*,)
I started with this code (found the basics on the shopware forum from DonAlfredo)
CREATE(WinHttp);
WinHttp.Open('GET','http://Niederxxxxxhop.de/api');
WinHttp.SetCredentials('ds','mTuzLxxxXXXXxxxXXXXxxxxXXXXxxxXXXnwJnt','');
WinHttp.Send('articles');
ResponseStream := WinHttp.ResponseStream;
ResponseBuffer.READ(ResponseStream);
ResponseFile.WRITEMODE(TRUE);
ResponseFile.CREATE('C:\Temp\Webshop.txt');
ResponseFile.CREATEOUTSTREAM(FileStream);
ResponseBuffer.WRITE(FileStream);
ResponseFile.CLOSE;
But the only reaction is already at the SetCredentials: (translated by myself, hope good enough)
The Call of the member SetCredentials is failed. WinHttp.WinHttpRequest returns this Message: The URL uses no known Protocoll.
So i think i need to add the Shop-url also in the credentials, but how? ](*,)
0
Answers
-
1. The prerequisites http://wiki.shopware.de/_detail_861_869.html Need to be fulfilled, Here the line "fastcgi_param HTTP_AUTHORIZATION $http_authorization;" because of NGIX.
2. No double authentication! We had one for the shop, and another one for the api. No go!
3. This code requests the active items form the shop and store it to a file:
CREATE(WinHttp);
WinHttp.Open('GET','http://Niederxxxxxshop.de/api/articles',FALSE);
WinHttp.SetCredentials('ds','mTuzxxxXXXXxxxXXXxxxxXXXxxxXXXxxxXnt',0);
WinHttp.Send;
ResponseStream := WinHttp.ResponseStream;
ResponseBuffer.READ(ResponseStream);
ResponseFile.WRITEMODE(TRUE);
ResponseFile.CREATE('C:\Temp\Webshop.txt');
ResponseFile.CREATEOUTSTREAM(FileStream);
ResponseBuffer.WRITE(FileStream);
ResponseFile.CLOSE;
Name DataType Subtype Length
WinHttp Automation 'Microsoft WinHTTP Services, version 5.1'.WinHttpRequest
ResponseStream InStream
FileStream OutStream
ResponseBuffer BigText
ResponseFile File
If interested: You can ask me for a complete Navision-included PIM including a complete native Navision connector to the SHOPWARE with items, unlimited values per item group, documents, long description (real long, not 250 chars!), Structures and so on.0 -
Hi, if someone is interested in a solution for Navision with Shopware or Navisoin with REST and JSON in general:
this Shopware-shop is now completly driven by Data out of Navision:
https://www.niederbergershop.de/
-Items
-technical details ("Attributes")
-Documents like PDF, Word, Excel (White papers, Data sheets)
-product pictures
-unlimited long descriptions
-Keywords
-Catalog tree
-Prices, Offers, Qty Prices, customer prices...
-stock
and many many more.
The orders placed in the shop are also automatically pulled by Navision. Navision updates the order in the shop with parcel tracking no's and delivery state.
You can find more informations here:
https://sites.google.com/site/renethoene/navision/pim
and here:
https://sites.google.com/site/renethoen ... e-mit-josn
currently only in german, if there is more interest i will also translate and offer in English.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