Wiki

Clone wiki

OCAPI / nl_customerController

Customer Controller

index

Vanuit dgeDetailhandel / dgeGroothandel kunnen klantaccounts worden aangemaakt, gewijzigd en verwijderd. Tevens is het mogelijk om nieuwe klantaccounts die op OpenCart zijn aangemaakt, toe te voegen aan dgeDetailhandel / dgeGroothandel.

Methods gebruikt door dgeDetailhandel / dgeGroothandel

POST 1 insert

Vanuit dgeDetailhandel / dgeGroothandel kan opdracht worden gegeven of voor een relatie een klantaccount aan te maken in OpenCart.

HEADERS
POST /oc2/ocapi/customer.xml HTTP/1.1
x-auth-token: e3a6a1fc0bf3e1f0c5dcb801caca5fb3
x-service-token: 555c7f149178099205edcc30
Content-Type: application/xml
Content-Length: 912
Host: jd.windev.nl
Connection: close
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<customer>
    <firstname>John</firstname>
    <lastname>Doe/lastname>
    <email>test@DgeBv.nl</email>
    <telephone>+31 112893457</telephone>
    <fax>+31 112893458</fax> 
        <address_id>9</address_id>
    <password>pipolalalalal</password>
    <customer_group_id>360</customer_group_id>
    <status>1</status>  
        <master>0</master>      
    <address>
                <address_id>9</address_id>
        <firstname>John</firstname>
        <lastname>Doe</lastname>
        <address_1>Straatjesweg 12</address_1>
        <address_2>Woonboot 3</address_2>
        <city>Hendrick IDO</city>
        <postcode>1123 AA</postcode>
        <country>NL</country>
        <company>Doe BV</company>
        <company_id>24191233</company_id>
        <tax_id>NL123456789B01</tax_id>
    </address>
    <address>
                <address_id>10</address_id>
        <firstname>Bill</firstname>
        <lastname>Doe</lastname>
        <address_1>Adresregelstraat 1</address_1>
        <city>Stad</city>
        <postcode>1124 AA</postcode>
        <country>NL</country>
    </address>
</customer>
Tags

De volgende tags worden door dgeDetailhandel / dgeGroothandel gebruikt.

niveau tag formaat aanwezig omschrijving
1 <customer> [1..1]
2 .<firstname> Tekst(32) [1..1] Voornaam
2 .<lastname> Tekst(32) [1..1] Achternaam
2 .<lastname> Nummeriek(9) [1..1] Default address id
2 .<email> Tekst(75) [1..1] Emailadres. Een emailadres is uniek. Het is niet toegestaan om voor hetzelfde emailadres meerdere klantaccounts aan te maken.
2 .<telephone> Tekst(25) [1..1] Telefoonnummer
2 .<fax> Tekst(25) [0..1] Faxnummer
2 .<password> Tekst(32) [1..1] Wachtwoord. De minimale lengte van het wachtwoord is 6.
2 .<customer_group_id> Numeriek(9) [1..1] OpenCart Customergroup ID. Zie nl_customergroupController.
2 .<status> Boolean [1..1] Status. Dit veld heeft de vaste waarde 1.
2 .<master> Number [1..1] 0 isMaster anders de customer_id van de master.
2 .<address> [1..n] Eén of meerdere bezorgadressen
3 ..<firstname> Tekst(32) [1..1] Voornaam
3 ..<lastname> Tekst(32) [1..1] Achternaam
3 ..<address_1> Tekst(50) [1..1] Adres
3 ..<address_2> Tekst(50) [0..1] Extra adresinformatie
3 ..<city> Tekst(50) [0..1] Woonplaats
3 ..<postcode> Tekst(10) [1..1] Postcode
3 ..<country> Tekst(2) [1..1] ISO landcode
3 ..<company> Tekst(40) [0..1] Bedrijfsnaam

RESPONSE

HEADERS
HTTP/1.1 200 Ok
Date: Fri, 22 May 2015 06:55:08 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: OC Dge Driver (v2)
Transfer-Encoding: chunked
Connection: close
Content-Type: application/xml; charset=utf-8
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <customer>
    <status>ok</status>
    <customer_id>167</customer_id>
  </customer>
</response>
Tags

De volgende tags worden door dgeDetailhandel / dgeGroothandel gebruikt.

niveau tag formaat aanwezig omschrijving
top <response> [1..1]
1 <customer> [1..1]
2 .<customer_id> Numeriek(9) [1..1] OpenCart Customer ID. Dit ID wordt in dgeDetailhandel / dgeGroothandel bewaard en gebruikt voor een toekomstig update of delete.

TESTPLAN

De volgende handelingen kunnen in dgeDetailhandel / dgeGroothandel worden uitgevoerd om de communicatie te testen:

POST 2 update

Met een update kan de klantgroep van een klantaccount worden bijgewerkt.

HEADERS
POST /oc2/ocapi/customer/167.xml HTTP/1.1
x-auth-token: e3a6a1fc0bf3e1f0c5dcb801caca5fb3
x-service-token: 555c7f149178099205edcc30
Content-Type: application/xml
Content-Length: 91
Host: jd.windev.nl
Connection: close
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<customer>
   <customer_group_id>11</customer_group_id>
   <status>1</status>
</customer>
Tags

De volgende tags worden door dgeDetailhandel / dgeGroothandel gebruikt.

niveau tag formaat aanwezig omschrijving
top <response> [1..1]
1 <customer> [1..1]
2 .<customer_group_id> Numeriek(9) [1..1] Het nieuwe OpenCart Customergroup ID. Zie nl_customergroupController.
2 .<status> Boolean [1..1] Status. Dit veld heeft de vaste waarde 1.

RESPONSE

HEADERS
HTTP/1.1 200 Ok
Date: Fri, 22 May 2015 06:55:08 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: OC Dge Driver (v2)
Transfer-Encoding: chunked
Connection: close
Content-Type: application/xml; charset=utf-8
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <customer>
    <status>ok</status>
    <customer_id>167</customer_id>
  </customer>
</response>
Tags

De volgende tags worden door dgeDetailhandel / dgeGroothandel gebruikt.

niveau tag formaat aanwezig omschrijving
top <response> [1..1]
1 <customer> [1..1]
2 .<customer_id> Numeriek(9) [1..1] OpenCart Customer ID. Dit ID wordt in dgeDetailhandel / dgeGroothandel bewaard en gebruikt voor een toekomstig update of delete.

DELETE 1

Met een Delete worden klantaccounts van OpenCart verwijderd. dgeDetailhandel / dgeGroothandel ondersteunt alleen de GET method om een klantaccount te verwijderen.

HEADERS
GET /oc2/ocapi/customer/delete/167.xml HTTP/1.1
x-auth-token: e3a6a1fc0bf3e1f0c5dcb801caca5fb3
x-service-token: 555c7f149178099205edcc30
Host: jd.windev.nl
Connection: close

RESPONSE

HEADERS
HTTP/1.1 200 Ok
Date: Fri, 22 May 2015 06:55:08 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: OC Dge Driver (v2)
Transfer-Encoding: chunked
Connection: close
Content-Type: application/xml; charset=utf-8
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <customer>
    <status>deleted</status>
    <customer_id>167</customer_id>
  </customer>
</response>

Voor dgeDetailhandel / dgeGroothandel is de HTTP statuscode 200 de bevestiging dat het klantaccount in OpenCart is verwijderd.

TESTPLAN

De volgende handelingen kunnen in dgeDetailhandel / dgeGroothandel worden uitgevoerd om de communicatie te testen:

GET Overview / List

Door middel van deze GET wordt door dgeDetailhandel / dgeGroothandel bepaald welke klantaccounts nieuw zijn aangemaakt in OpenCart. Van deze klantaccounts wordt een relatie aangemaakt in dgeDetailhandel / dgeGroothandel.

HEADERS
GET /oc2/ocapi/customer.xml?start=0&limit=10
x-auth-token: e3a6a1fc0bf3e1f0c5dcb801caca5fb3
x-service-token: 555c7f149178099205edcc30
Host: jd.windev.nl
Connection: close

RESPONSE

HEADERS
HTTP/1.1 200 Ok
Date: Fri, 22 May 2015 06:55:08 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: OC Dge Driver (v2)
Transfer-Encoding: chunked
Connection: close
Content-Type: application/xml; charset=utf-8
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <customer>
    <customer_id>7</customer_id>
    <customer_group_id>4</customer_group_id>
    <store_id>0</store_id>
    <firstname>Arjan</firstname>
    <lastname>w</lastname>
    <email>aw@dgebv.nl</email>
    <telephone>-</telephone>
    <fax></fax>
    <newsletter>0</newsletter>
    <address_id>7</address_id>
    <custom_field>s:0:"";</custom_field>
    <status>1</status>
    <approved>1</approved>
    <safe>1</safe>
    <date_added>2015-03-11 16:15:24</date_added>
    <language_id>2</language_id>
    <name>Arjan w</name>
    <description>DEFAULT DGE</description>
    <customer_group>DEFAULT DGE</customer_group>
    <address>
      <address_id>7</address_id>
      <customer_id>7</customer_id>
      <firstname>Arjan</firstname>
      <lastname>w</lastname>
      <company>Arjan</company>
      <address_1>Weel 12</address_1>
      <address_2></address_2>
      <postcode>4306 NW</postcode>
      <city>NIEUWERKERK</city>
      <zone_id>0</zone_id>
      <zone></zone>
      <zone_code></zone_code>
      <country_id>150</country_id>
      <country>Netherlands</country>
      <iso_code_2>NL</iso_code_2>
      <iso_code_3>NLD</iso_code_3>
      <address_format></address_format>
      <custom_field></custom_field>
    </address>
  </customer>
  <customer>
    <customer_id>5</customer_id>
    <customer_group_id>3</customer_group_id>
    <store_id>0</store_id>
    <firstname>Naam</firstname>
    <lastname>Achternaam</lastname>
    <email>email1@...</email>
    <telephone>0111411000</telephone>
    <fax></fax>
    <newsletter>0</newsletter>
    <address_id>5</address_id>
    <custom_field>s:7:"s:0:"";";</custom_field>
    <status>1</status>
    <approved>1</approved>
    <safe>1</safe>
    <date_added>2015-01-21 15:48:06</date_added>
    <language_id>2</language_id>
    <name>Naam Achternaam</name>
    <description>KLGR_0+KORTPERC_10+INKOPSL_0</description>
    <customer_group>KLGR_0+KORTPERC_10+INKOPSL_0</customer_group>
    <address>
      <address_id>5</address_id>
      <customer_id>5</customer_id>
      <firstname>Iemand</firstname>
      <lastname>Anders</lastname>
      <company></company>
      <address_1>Demostraat 11</address_1>
      <address_2></address_2>
      <postcode>1111 AA</postcode>
      <city>DIEMEN</city>
      <zone_id>0</zone_id>
      <zone></zone>
      <zone_code></zone_code>
      <country_id>150</country_id>
      <country>Netherlands</country>
      <iso_code_2>NL</iso_code_2>
      <iso_code_3>NLD</iso_code_3>
      <address_format></address_format>
      <custom_field></custom_field>
    </address>
  </customer>
  <customer>
    <customer_id>4</customer_id>
    <customer_group_id>2</customer_group_id>
    <store_id>0</store_id>
    <firstname>User 2</firstname>
    <lastname>Lastname</lastname>
    <email>email2@...</email>
    <telephone>01114111111</telephone>
    <fax></fax>
    <newsletter>1</newsletter>
    <address_id>4</address_id>
    <custom_field>s:7:"s:0:"";";</custom_field>
    <status>1</status>
    <approved>1</approved>
    <safe>1</safe>
    <date_added>2015-01-21 15:47:44</date_added>
    <language_id>2</language_id>
    <name>Iemand</name>
    <description>KLGR_0+KORTPERC_20+INKOPSL_0</description>
    <customer_group>KLGR_0+KORTPERC_20+INKOPSL_0</customer_group>
    <address>
      <address_id>4</address_id>
      <customer_id>4</customer_id>
      <firstname>Naam</firstname>
      <lastname>Achternaam</lastname>
      <company></company>
      <address_1>Demostraat 11</address_1>
      <address_2></address_2>
      <postcode>1111 AA</postcode>
      <city>DIEMEN</city>
      <zone_id>0</zone_id>
      <zone></zone>
      <zone_code></zone_code>
      <country_id>150</country_id>
      <country>Netherlands</country>
      <iso_code_2>NL</iso_code_2>
      <iso_code_3>NLD</iso_code_3>
      <address_format></address_format>
      <custom_field></custom_field>
    </address>
  </customer>
</response>
Tags

De volgende tags worden door dgeDetailhandel / dgeGroothandel gebruikt.

niveau tag formaat aanwezig omschrijving
top <response> [1..1]
1 <customer> [1..1]
2 .<customer_id> Numeriek(9) [1..1] OpenCart Customer ID. Dit ID wordt in dgeDetailhandel / dgeGroothandel bewaard en gebruikt voor een toekomstig update of delete.
2 .<customer_group_id> Numeriek(9) [1..1] OpenCart Customergroup ID.
2 .<firstname> Tekst(32) [1..1] Voornaam
2 .<lastname> Tekst(32) [1..1] Achternaam
2 .<email> Tekst(75) [1..1] Emailadres
2 .<telephone> Tekst(25) [1..1] Telefoonnummer
2 .<fax> Tekst(25) [0..1] Faxnummer
2 .<address> [1..n] Eén of meerdere bezorgadressen
3 ..<firstname> Tekst(32) [1..1] Voornaam
3 ..<lastname> Tekst(32) [1..1] Achternaam
3 ..<address_1> Tekst(50) [1..1] Adres
3 ..<address_2> Tekst(50) [0..1] Extra adresinformatie
3 ..<postcode> Tekst(10) [1..1] Postcode
3 ..<city> Tekst(50) [1..1] Woonplaats
3 ..<iso_code_2> Tekst(2) [1..1] ISO landcode
3 ..<company> Tekst(40) [0..1] Bedrijfsnaam

TESTPLAN

De volgende handelingen kunnen in dgeDetailhandel / dgeGroothandel worden uitgevoerd om de communicatie te testen:

Overige methods

De onderstaande methods worden niet door dgeDetailhandel / dgeGroothandel gebruikt en hoeven dus niet te worden geïmplementeerd.

POST 3 insert

Minimale gebruiker toevoegen

HEADERS
POST /oc2/ocapi/customer.xml HTTP/1.1
x-auth-token: e3a6a1fc0bf3e1f0c5dcb801caca5fb3
x-service-token: 555c7f149178099205edcc30
Content-Type: application/xml
Content-Length: 212
Host: jd.windev.nl
Connection: close
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<root>
    <firstname>John</firstname>
    <lastname>Doe</lastname>
    <email>test@DgeBv.nl</email>
    <telephone>+31 112893457</telephone>
    <password>pipopipoqwede</password>
</root>

RESPONSE

HEADERS
HTTP/1.1 200 Ok
Date: Fri, 22 May 2015 06:55:08 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: OC Dge Driver (v2)
Transfer-Encoding: chunked
Connection: close
Content-Type: application/xml; charset=utf-8
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <customer>
    <status>ok</status>
    <customer_id>166</customer_id>
  </customer>
</response>

GET DETAILS

HEADERS
GET /oc2/ocapi/customer/167.xml HTTP/1.1
x-auth-token: e3a6a1fc0bf3e1f0c5dcb801caca5fb3
x-service-token: 555c7f149178099205edcc30
Host: jd.windev.nl
Connection: close

RESPONSE

HEADERS
HTTP/1.1 200 Ok
Date: Fri, 22 May 2015 06:55:08 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: OC Dge Driver (v2)
Transfer-Encoding: chunked
Connection: close
Content-Type: application/xml; charset=utf-8
CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <customer>
    <customer_id>167</customer_id>
    <customer_group_id>360</customer_group_id>
    <store_id>0</store_id>
    <firstname>John 2</firstname>
    <lastname>Doe 2</lastname>
    <email>test@dgebv.nl</email>
    <telephone>+31 112893457</telephone>
    <fax></fax>
    <newsletter>0</newsletter>
    <address_id>165</address_id>
    <custom_field>s:0:"";</custom_field>
    <status>1</status>
    <approved>1</approved>
    <safe>1</safe>
    <date_added>2015-05-22 08:55:08</date_added>
    <address>
      <address_id>165</address_id>
      <customer_id>167</customer_id>
      <firstname>John</firstname>
      <lastname>Doe</lastname>
      <company></company>
      <address_1>Straatjes weg 12</address_1>
      <address_2></address_2>
      <postcode>Aa1123</postcode>
      <city>Hendrick IDO</city>
      <zone_id>2340</zone_id>
      <zone>Zuid Holland</zone>
      <zone_code>ZH</zone_code>
      <country_id>150</country_id>
      <country>Netherlands</country>
      <iso_code_2>NL</iso_code_2>
      <iso_code_3>NLD</iso_code_3>
      <address_format></address_format>
      <custom_field></custom_field>
    </address>
    <address>
      <address_id>166</address_id>
      <customer_id>167</customer_id>
      <firstname>John</firstname>
      <lastname>Doe</lastname>
      <company>Circus inc. and son's</company>
      <address_1>Adresregelstraat 1</address_1>
      <address_2>3 hoog boven</address_2>
      <postcode>Aa1124</postcode>
      <city>Stad in NL</city>
      <zone_id>2339</zone_id>
      <zone>Zeeland</zone>
      <zone_code>ZE</zone_code>
      <country_id>150</country_id>
      <country>Netherlands</country>
      <iso_code_2>NL</iso_code_2>
      <iso_code_3>NLD</iso_code_3>
      <address_format></address_format>
      <custom_field></custom_field>
    </address>
  </customer>
</response>

index

Updated