Creating Category using WebAPI

Posted By Boxson Wed 30 Oct 2013
Add to Favorites0
Author Message
Boxson
 Posted Wed 30 Oct 2013
Supreme Being

Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)

Group: Forum Members
Last Active: Thu 12 Dec 2013
Posts: 14, Visits: 70
Hi,

i'm trying to connect Kartirs to our base system. Therefore i need to sync the categories to kartris. I try that using the WebAPI.

For creating new Categories i utilize the method "CategoriesBLL._Add".

Is it possible to get the CAT_ID of a newly created Category via WebAPI? I need to build parent-/child relations during sync. Therefore i need to know the ID of a created Category in Kartris. Additional i need to store the CAT_ID of a Kartris Category in my Base System for later sync (modification, deletion of category in base system and so on.)

I tried to search for a created category with "CategoriesBLL.SearchCategoryByName", but this method returns all Categories that have the search-team in it and the Category-title in this case had to be unique.
Medz
 Posted Thu 31 Oct 2013
Kartris Expert

Kartris Expert - (58,954 reputation)Kartris Expert - (58,954 reputation)Kartris Expert - (58,954 reputation)Kartris Expert - (58,954 reputation)Kartris Expert - (58,954 reputation)Kartris Expert - (58,954 reputation)Kartris Expert - (58,954 reputation)Kartris Expert - (58,954 reputation)Kartris Expert - (58,954 reputation)

Group: Administrators
Last Active: Tue 3 Dec 2013
Posts: 99, Visits: 1,400
The WebAPI only outputs the value returned by the called function at the moment. It doesn't work very well with ones that have ByRef parameters as you can't retrieve the value passed to those variables through an API call. In your case, the _AddCategory uses the pCategoryID ByRef parameter to return the newly created category ID to the user. At the moment, you'll only be able to get the boolean value that the function returns.

A way of accomplishing this (get CAT ID) for now is by modifying CategoriesBLL and adding a custom AddCategory function there that returns the PCategoryID instead of a boolean value. You can just duplicate and rename the existing _AddCategory function and modify the copy according to your needs. The WebAPI is flexible enough that custom functions can also be accessed through it the same as the standard ones.
Boxson
 Posted Thu 31 Oct 2013
Supreme Being

Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)

Group: Forum Members
Last Active: Thu 12 Dec 2013
Posts: 14, Visits: 70
Thanks for the answer,

i'll try that. I tried to Create a Category. Therefore i need to hand over some data as a "DataTable" to the Method _AddCategory. This needs to be parsed as XML additional to the other params within the strParametersXML string.

Do you - or somebody else - have kind of an example how the xml has to look like? If i send a dataTable as xml, i only recieve the result

<?xml version="1.0" encoding="utf-16"?><string>Error parsing method string! Exception Details -&gt; Error in XML-Document (1,1).".


I'm stuck with this for hours now. Without any information how the webservice data needs to be sent it is "try and error"...

BoXson
Thu 31 Oct 2013 by Boxson
Boxson Marked As Answer
 Posted Wed 6 Nov 2013
Supreme Being

Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)Supreme Being - (9,576 reputation)

Group: Forum Members
Last Active: Thu 12 Dec 2013
Posts: 14, Visits: 70

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top