Connect Navision with Shopware with WinHttp to REST-Api

rthswrthsw 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? ](*,)

Answers

  • rthswrthsw Member Posts: 73
    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.
  • rthswrthsw Member Posts: 73
    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.
Sign In or Register to comment.