# Bundesland/StateId der Shoporder

**URL:** <https://forum.shopware.com/t/bundesland-stateid-der-shoporder/28580>\
**Category:** Allgemein\
**Created:** [1. Juli 2015 um 16:01 UTC](https://forum.shopware.com/t/bundesland-stateid-der-shoporder/28580 "2015-07-01T16:01:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dedackel](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Dedackel](https://forum.shopware.com/u/Dedackel)\
**Post date:** [1. Juli 2015 um 16:01 UTC](https://forum.shopware.com/t/bundesland-stateid-der-shoporder/28580/1 "2015-07-01T16:01:25Z")

</div>

Hallo zusammen, ich möchte das Bundesland der Shoporder über die Shopware-Api auslesen, d.h. ich brauche die Tabellenfelder s\_order\_billingadress.stateID und s\_order\_shippingadress.stateID. Die Klassen der Rest API enthalten allerdings nur Country Informationen. Kann mir da jemand weiterhelfen? Schon mal vielen Dank vorab!

---

<div class="post-metadata">

**Author:** ![Heiner\_Lohaus](https://avatars.discourse-cdn.com/v4/letter/h/b5a626/32.png) [@Heiner\_Lohaus](https://forum.shopware.com/u/Heiner_Lohaus)\
**Post date:** [1. Juli 2015 um 16:39 UTC](https://forum.shopware.com/t/bundesland-stateid-der-shoporder/28580/2 "2015-07-01T16:39:52Z")

</div>

Hi, das Feld “stateId” gibt es in der API genauso wie das Feld “countryId”. Ein Problem kann ich hier nicht erkennen. Gruß Heiner

---

<div class="post-metadata">

**Author:** ![sptest](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sptest](https://forum.shopware.com/u/sptest)\
**Post date:** [1. Juli 2015 um 20:44 UTC](https://forum.shopware.com/t/bundesland-stateid-der-shoporder/28580/3 "2015-07-01T20:44:42Z")

</div>

The information desired from orders is the following `"state": { "id": 37, "name": "California" }` or `"billing": { "id": xyz, "orderId": dddd, "customerId": ddd, "countryId": 2, "stateId": 5 ...` If „state“ or „stateId“ information is not available then the lack of information should be expressed in the following way `"state": { "id": "", "name": "" }` or `"state": {} }` or `"billing": { "id": xyz, "orderId": dddd, "customerId": ddd, "countryId": 2, "stateId": 0, ...` or etc I was NOT able to find the field „state“ or „stateId“ in any of my samples GET /api/orders/{id} Json answers. This fact is apparently confirmed by official :shopware: [documentation](http://community.shopware.com/%5C_detail%5C_1690.html). In this example (modified to be anonymous) is impossible to find a „state“ field: ` ... "billing": { "id": xyz, "orderId": dddd, "customerId": ddd, "countryId": 2, "company": "sssssssssssssssssssss", "department": "", "salutation": "ms", "number": "", "firstName": "sssssssss", "lastName": "sssssssssss", "street": "sssssssssss", "streetNumber": "dd", "zipCode": "ddddd", "city": "sssssssssss", "phone": "", "fax": "", "vatId": "DEddddddddd", "country": { "id": 2, "name": "Deutschland", "iso": "DE", "isoName": "Deutschland", "position": 1, "description": "", "shippingFree": false, "taxFree": 0, "taxFreeUstId": 0, "taxFreeUstIdChecked": 0, "active": true, "iso3": "DEU", "displayStateInRegistration": false, "forceStateInRegistration": false, "areaId": 1 }, "attribute": { "id": xyz, "orderBillingId": xyz, "text1": "", "text2": "", "text3": "", "text4": "", "text5": "", "text6": "" } }, "shipping": { "id": xyz, "orderId": dddd, "countryId": 30, "customerId": ddd, "company": "", "department": "", "salutation": "mr", "firstName": "ssss", "lastName": "ssssssssss", "street": "sssssss", "streetNumber": "dsspdd", "zipCode": "ddddd", "city": "sssssss", "attribute": { "id": xyz, "orderShippingId": xyz, "text1": "", "text2": "", "text3": "", "text4": "", "text5": "", "text6": "" }, "country": { "id": 30, "name": "Poland", "iso": "PL", "isoName": "Poland", "position": 10, "description": "", "shippingFree": false, "taxFree": 0, "taxFreeUstId": 1, "taxFreeUstIdChecked": 0, "active": true, "iso3": "POL", "displayStateInRegistration": false, "forceStateInRegistration": false, "areaId": 2 } }, ...` Note for the casual reader: areaId is not stateId, it is the Country Area number (Germany/Europe/Rest of the World). Is it possible that Json answer’s structure change (not officially documented) if „displayStateInRegistration“: true, „forceStateInRegistration“: false, or „displayStateInRegistration“: true, „forceStateInRegistration“: true, ? In particular, is a field „state“: { „id“: , „name“: „“ } added somewhere in the Json answer? --------------------------------------------------------- Otherwise the user Dedackel (and every one else that desire to retrieve the StateId data from a Json GET’s answer /api/orders/{id}) should try to add/modify the PHP code realted to orders API. I have modified some Shopware’s PHP code before but I have never personally modified the PHP code related to an API. But maybe I could give some hints about a possible solution to the problem. Inside the following [document](http://de.slideshare.net/shopware/rest-apivortrag-22841490) from page 29 to page 35 (REST-API erweitern/Tax aka REST-API extension / Tax example), it is described a prodedure to add a new REST GET API related to Tax. The reader could check [here](http://community.shopware.com/REST-API-Ressourcen-Uebersicht%5C_detail%5C_1680.html) to see that Tax is a REST API that do not exist by default. Another document (with more information) about API extension is the following :shopware: [link](http://community.shopware.com/Shopware-4-API-erweitern%5C_detail%5C_991.html). Sorry, because I have never used this procedure before, I don’t know if it is the right procedure 1) to use in the case is necessary to modify an already existing API (orders in this case: /api/orders/{id} ) or 2) if it is necessary (and possible) to create a duplicated version (but modified to include state field) of orders API (for example /api/orders2/{id} or /api/myorders/{id}). Best Regards -----
