How to fetch the product ID after creating the product from the API

New Member
6 0 0

Hi all,

I'm using react native and I'm creating a product and then saving it to Shopify but I want to fetch the product ID which I created.(Find the code below)

 How to return the product ID after created in Shopify because I want to update the DB with global product ID.

Thanks in advance.

uploadDatatoShopify() {

    var data = JSON.stringify({
      "product": {
        "title": this.state.artworkTitle,
        "body_html": this.state.artworkDescription,
        "product_type": this.state.category,
        "images": [
            "alt": null,
            "src": this.state.links

    var xhr = new XMLHttpRequest();
    xhr.withCredentials = true;

    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
    });"POST", "username_token and store name//admin/products.json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("x-shopify-access-token", "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");
    xhr.setRequestHeader("cache-control", "no-cache");