API Request and Answer

#1

Hello SeoTools Community,

I'm trying to use an API from nexmart.de to request things like productprice and stock but after 7 days of try and error I really need your help. Otherwise i'm getting crazy. :crazy_face:

This is what I actually tried:
=Dump(JsonPathOnUrl("https://www.nexmart.com/api/uploadbasket";"$.basketId";HttpSettings(WAHR;;;"200|200|Host";"POST";;;{"ClientId"."SoapUI_Client";"portalId"."nexmart.de";"organisation"."BDE******";"userName"."";"password"."";"marketplace"."nexmart";"login"."********";"customerNumber"."*****************"})))

These are the important documentation-parts:

This is the request process:

  1. send products via API
  2. return a generated Basket ID from nexmart
  3. send Basket ID
  4. return stock and/or product prices

Thank you.

Max

#2

Hi Max,

I would say it gets too complicated to send SOAP requests via Seotools formulas and populating the SOAP protocol as a body. I would try to create a connector for this. You can start with one of the existing connector xml files located in the Connectors folder. Here is an example of a request you can edit to this API:

  <RestConnector Id="Accounts" Title="List Accounts">
    <Fetch>
      <HttpSettings>
        <RequestHeaders>
          <Header Name="SOAPAction">FindAccountsOrCustomersInfo</Header>
        </RequestHeaders>
        <RequestMethod>POST</RequestMethod>
        <RequestContentType>text/xml; charset=utf-8</RequestContentType>
        <RequestBody>
          <![CDATA[
           <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
            <s:Header>
              <h:ApplicationToken i:nil="true" xmlns:h="https://bingads.microsoft.com/Customer/v12" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/>
              <h:AuthenticationToken xmlns:h="https://bingads.microsoft.com/Customer/v12">@(Model.Authenticator.Token)</h:AuthenticationToken>
              <h:DeveloperToken xmlns:h="https://bingads.microsoft.com/Customer/v12">1193759878590095</h:DeveloperToken>
            </s:Header>
            <s:Body>
              <FindAccountsOrCustomersInfoRequest xmlns="https://bingads.microsoft.com/Customer/v12">
                <Filter/>
                <TopN>1000</TopN>
              </FindAccountsOrCustomersInfoRequest>
            </s:Body>
          </s:Envelope>
          ]]>
        </RequestBody>
      </HttpSettings>
      <Fetch.Url>
        <![CDATA[
          https://clientcenter.api.bingads.microsoft.com/Api/CustomerManagement/v12/CustomerManagementService.svc
        ]]>
      </Fetch.Url>
    </Fetch>
    <Parse>
      <Xpath Expr="//*[name()='accountinfowithcustomerdata']/*[name()='a:accountinfowithcustomerdata']">
				<Xpath Expr="./*[name()='a:accountid']" Id="AccountId" Converter="Auto"/>
        <Xpath Expr="./*[name()='a:accountname']" Id="AccountName"/>
        <Xpath Expr="./*[name()='a:accountnumber']" Id="AccountNumber" Converter="Auto"/>
        <Xpath Expr="./*[name()='a:accountlifecyclestatus']" Id="AccountStatus"/>
        <Xpath Expr="./*[name()='a:customerid']" Id="CustomerId" Converter="Auto"/>
        <Xpath Expr="./*[name()='a:customername']" Id="CustomerName"/>
      </Xpath>
    </Parse>
    <Resource Id="Fail"/>
  </RestConnector>
#3

Okay, thank you very much.
I'll try my best to create my own connector.