Alt Kategori Bilgilerini Listeleme (GetSubCategories)
Alt Kategori Bilgilerini Listeleme (GetSubCategories)
Kategori servisleri için WSDL adresi: https://api.n11.com/ws/CategoryService.wsdl
Kodu verilen kategorinin birinci seviye alt kategorilerine ulaşmak için bu metot kullanılmalıdır. İkinci seviye alt kategorilere ulaşmak için (Örn. “Giysi -> Ayakkabı -> Deri ayakkabı” kategori ağacında “Deri ayakkabı” bilgisi) birinci Seviye alt kategorinin (Örn. Ayakkabı) kodu verilerek tekrar servis çağırılmalıdır.
Sorgulanan kategori sistemde bulunamazsa hata alınır. Eğer ilgili kategori herhangi bir alt kategoriye sahip değilse response bilgisi boş döner.
GetSubCategoriesRequest
auth | Bkz: Yetkilendirme |
categoryId | Alt kategori id bilgisi |
*Bold alanlar zorunlu alanlardır
GetSubCategoriesResponse
result | Bkz: Result |
category.id | Alt kategori id bilgisi |
category.name | Kategori Adı |
subCategoryList.subCategory.id | Bir alt kategori id bilgisi |
subCategoryList.subCategory.name | Bir alt kategori adı |
GetSubCategory Örnek Çağrı
Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www.n11.com/ws/schemas">
<soapenv:Header/>
<soapenv:Body>
<sch:GetSubCategoriesRequest>
<auth>
<appKey>***</appKey>
<appSecret>***</appSecret>
</auth>
<categoryId>1002720</categoryId>
</sch:GetSubCategoriesRequest>
</soapenv:Body>
</soapenv:Envelope>
Response
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns3:GetSubCategoriesResponse xmlns:ns3="http://www.n11.com/ws/schemas">
<result>
<status>success</status>
</result>
<category>
<id>1002720</id>
<name>Taşsız Bileklik</name>
</category>
</ns3:GetSubCategoriesResponse>
</env:Body>
</env:Envelope>
GetSubCategory Örnek Çağrı (Java)
public static void main(String[] args) {
String strAppKey = "***";
String strAppSecret = "***";
long categoryIdValue = 1002720L;
Authentication authentication = new Authentication();
authentication.setAppKey(strAppKey);
authentication.setAppSecret(strAppSecret);
GetSubCategoriesRequest request = new GetSubCategoriesRequest();
request.setAuth(authentication);
request.setCategoryId(categoryIdValue);
CategoryServicePort port = new CategoryServicePortService().getCategoryServicePortSoap11();
GetSubCategoriesResponse subCategoryResponse = port.getSubCategories(request);
List<SubCategoryData> subCategoryList = subCategoryResponse.getCategory();
System.out.println("Names of sub categories are: ");
for (SubCategoryData sampleData: subCategoryList) {
System.out.println(sampleData.getId() + " " + sampleData.getName()); }}
Yetkilendirme (Authentication)
auth.appKey | Servislere erişim için kullanılacak uygulama anahtarı |
auth.appSecret | Servislere erişim için kullanılacak uygulama şifresi |
Sonuç Durum Bilgisi (Result)
result.status | İşlem sonucu durum bilgisini gösterir. “success” ve “failure” durum bilgilerini döner. |