API not working on product addition and removal

  • wopa_stamps

    23 Beiträge

    Gibraltar

    Hi, we are experiencing issues with product addition and removal from Delcampe. When we push products from our own website to Delcampe they don't manage to go through, and when we try to remove them from Delcampe the process doesn't complete.

    The issue is rather urgent as we have a good amount of products to add and another good amount to remove, which is affecting our sales, so any quick action would be greatly appreciated.

    Thanking you in advance.
  • koalastamps

    60 Beiträge

    Australien

    Hi, we are experiencing issues with product addition and removal from Delcampe. When we push products from our own website to Delcampe they don't manage to go through, and when we try to remove them from Delcampe the process doesn't complete.

    The issue is rather urgent as we have a good amount of products to add and another good amount to remove, which is affecting our sales, so any quick action would be greatly appreciated.

    Thanking you in advance.
    • Erstellt am 03.07.2017 um 05:39
    • #718183
    This sounds like the same problem that I'm experiencing and also reported here.

    So many stores must be experiencing this issue.

    I also hope you can urgently fix this. Thanks.
  • @dorian
    Administrator

    69 Beiträge

    Belgien

    Hi, we are experiencing issues with product addition and removal from Delcampe. When we push products from our own website to Delcampe they don't manage to go through, and when we try to remove them from Delcampe the process doesn't complete.

    The issue is rather urgent as we have a good amount of products to add and another good amount to remove, which is affecting our sales, so any quick action would be greatly appreciated.

    Thanking you in advance.
    • Erstellt am 03.07.2017 um 05:39
    • #718183
    Hello wopa_stamps,

    In order to help you, we would need some more infos,

    - Which calls do you use to manage your additions and removals?
    - What kind of response did you get back from these calls?

    Regards,
  • @dorian
    Administrator

    69 Beiträge

    Belgien

    This sounds like the same problem that I'm experiencing and also reported here.

    So many stores must be experiencing this issue.

    I also hope you can urgently fix this. Thanks.
    • Erstellt am 03.07.2017 um 07:43
    • #718249
    Hello koalastamps,

    If you could also reply to these,

    - Which calls do you use to manage your additions and removals?
    - What kind of response did you get back from these calls?

    Regards,
  • koalastamps

    60 Beiträge

    Australien

    Hi @dorian, as per my posts, NOTHING. I submit say 300 new listings and only 5 or 6 are added. That is, my script is set up say to loop 300 times to add 300 new listings. It executes about 5 or 6 times (these listings add ok) then does not return after executing the curl _exec() command. So nothing is returned.

    You should be able to easily test this - have you done a load / stress test?
  • koalastamps

    60 Beiträge

    Australien

    Hi @dorian, as per my posts, NOTHING. I submit say 300 new listings and only 5 or 6 are added. That is, my script is set up say to loop 300 times to add 300 new listings. It executes about 5 or 6 times (these listings add ok) then does not return after executing the curl _exec() command. So nothing is returned.

    You should be able to easily test this - have you done a load / stress test?
    • Erstellt am 03.07.2017 um 19:19
    • #718537
    Here's a code snippet: For example, this should perform 300 times to add 300 items.

    function process_update() {
    global $db, $cron_job_id;
    $updatestoresuccess = 0;
    //get products with updated flag=1
    $sql="SELECT p.product_id, p.quantity, p.image, p.price, pd.name, pd.description, ifnull(ca.delcampe_category,0) as category_id, puf.store_product_id, puf.image_changed, puf.store_product_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON p.product_id = pd.product_id LEFT JOIN " . DB_PREFIX . "product_update_flag puf ON p.product_id = puf.product_id LEFT JOIN " . DB_PREFIX . "product_to_category pc ON p.product_id = pc.product_id LEFT JOIN " . DB_PREFIX . "category ca ON ca.category_id = pc.category_id WHERE puf.updated_flag=1";

    $result_query = $db->query($sql);

    $db->query("UPDATE " . DB_PREFIX . "product_cronjob SET updated_product_count=" . $result_query->num_rows . " WHERE job_id = '" . $cron_job_id . "'");
    if ($result_query->num_rows != 0) {
    foreach ($result_query->rows as $result) { <<< FOR 300 NEW PRODUCTS, $RESULT = 300 >>>
    $productid = (int) $result['product_id'];
    $categoryid = (int) $result['category_id'];
    $price = $result['price'];
    $title = $result['name'];
    $quantity = (int) $result['quantity'];
    $description = $result['description'];
    $image = $result['image'];
    $image_changed = $result['image_changed'];
    $store_product_id = $result['store_product_id'];
    if (doStoreUpdateProduct($productid, $categoryid, $price, $title, $quantity, $description, $image, $image_changed, $store_product_id)) {
    $updatestoresuccess+=1;
    }
    }
    }

    $db->query("UPDATE " . DB_PREFIX . "product_cronjob SET updated_product_store=" . $updatestoresuccess . " WHERE job_id = '" . $cron_job_id . "'");
    }

    function doStoreAddProduct($productid, $categoryid, $price, $title, $quantity, $description, $image, $image_changed) {
    global $db;
    $sellertoken = get_valid_token('add-token', $productid);
    if ($sellertoken != "") {
    if ($image!=NULL) {
    $arrimage = array(HTTP_SERVER . "image/" . $image);
    } else {
    $arrimage = array();
    }

    //add product to delcampe store
    $product = array(
    'type' => 'fixedPrice',
    'item' => array(
    // MANDATORY DATA
    'id_country' => 0,
    'id_category' => $categoryid,
    'fixed_price' => $price,
    'currency' => 'AUD',
    'title' => $title,
    'personal_reference' => $productid,
    //OPTIONAL DATA
    'qty' => $quantity,
    'description' => htmlspecialchars_decode($description),
    'images' => $arrimage,
    'duration' => 28,
    'renew' => 99
    )
    );
    $url = ' Link (http) =' . $sellertoken;

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($product));
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    //Tell cURL that it should only spend 10 seconds trying to connect to the URL
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); <<< CONNECTION IS ALWAYS OK >>>
    //A given cURL operation should only take 30 seconds max
    curl_setopt($ch, CURLOPT_TIMEOUT, 30); <<< NO TIMEOUT RESPONSE OCCURS >>>
    $xml_response = curl_exec($ch);
    $xml = simplexml_load_string($xml_response); <<<THERE IS NO RESPONSE after 5 or 6 EXECUTIONS, DIES!!! >>>

    if (isset($xml->Notification_Data->body->error)) {
    $db->query("UPDATE " . DB_PREFIX . "product_update_flag SET error_desc='" . (string) $xml->Notification_Data->body->error . "' WHERE product_id = '" . $productid . "'");
    return false;
    } else {
    $perref = (string) $xml->Notification_Data->body->item->personal_reference;
    //get store product id
    $storeproductid = getStoreProductID($sellertoken, $perref, $productid);
    if ($storeproductid != "") {
    $db->query("UPDATE " . DB_PREFIX . "product_update_flag SET added_flag=0, store_product_id='" . (string) $storeproductid . "' WHERE product_id = '" . $productid . "'");
    }
    return true;
    }
    }
    }
  • @dorian
    Administrator

    69 Beiträge

    Belgien

    Hi @dorian, as per my posts, NOTHING. I submit say 300 new listings and only 5 or 6 are added. That is, my script is set up say to loop 300 times to add 300 new listings. It executes about 5 or 6 times (these listings add ok) then does not return after executing the curl _exec() command. So nothing is returned.

    You should be able to easily test this - have you done a load / stress test?
    • Erstellt am 03.07.2017 um 19:19
    • #718537
    Hi koalastamps,

    In order to complete a multiple insert, it's more efficient to use this dedicated call:
    Link (https)

    Please try this out and come back to us if you got any issue.
  • wopa_stamps

    23 Beiträge

    Gibraltar

    Hi Dorian,

    Which calls do you use to manage your additions and removals?

    rest api call to Link (http)

    What kind of response did you get back from these calls?

    no error otherwise my script would have informed me.

    Thanks
  • wopa_stamps

    23 Beiträge

    Gibraltar

    Hi Dorian,

    Any news on the above?

    Thank you.
  • @dorian
    Administrator

    69 Beiträge

    Belgien

    Hi Dorian,

    Any news on the above?

    Thank you.
    • Erstellt am 06.07.2017 um 06:35
    • #719332
    Hi wopa_stamps,

    The link you gave me Link (http) is used to retrieve your token.

    Having this token you can use following calls :
    - to add a single item Link (https)
    - to add multiple items Link (https)
    - to close a sale Link (https)

    If you didn't get any xml response, what http response do you get back?

Werden Sie Mitglied der Sammler-Community!

Anmelden Einloggen