Create Attribute set in Magento 2 using Api

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












I am trying to create an attribute set and assign multiple attribute into it using rest api in Magento2.
Please help me in this regard.










share|improve this question



























    up vote
    2
    down vote

    favorite












    I am trying to create an attribute set and assign multiple attribute into it using rest api in Magento2.
    Please help me in this regard.










    share|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I am trying to create an attribute set and assign multiple attribute into it using rest api in Magento2.
      Please help me in this regard.










      share|improve this question













      I am trying to create an attribute set and assign multiple attribute into it using rest api in Magento2.
      Please help me in this regard.







      magento2 rest-api attribute-set






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 4 hours ago









      Magento Learner

      1309




      1309




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Magento 2 already have an API point for creating an attribute set.



          http://www.example.com/rest/V1/products/attribute-sets


          You have to hit API point



          and have to post below value



           
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4



          Here ,here



          • skeletonId is the attribute set id on which your new attribute set
            TESTAMIT build. Here 4 is Magento default attribute set Default Id

          • "entity_type_id": 4 ,Here 4 products entity type id. Most of the time, when you want to build a new build that time system asking which attributes structure will you want to follow.

          Example at CURL



          curl -X POST 
          http://www.example.com/rest/V1/products/attribute-sets
          -H 'authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4'
          -H 'cache-control: no-cache'
          -H 'content-type: application/json'
          -H 'postman-token: 33e5dccd-7776-e22b-1a24-b484473cbe86'
          -d '
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4
          '


          PHP CURL



          <?php

          $curl = curl_init();

          curl_setopt_array($curl, array(
          CURLOPT_URL => "http://www.example.com/rest/V1/products/attribute-sets",
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => "n "attributeSet": n "attribute_set_name": "TESTAMIT",n "sort_order": 10,n "entity_type_id": 4n ,n "skeletonId": 4n",
          CURLOPT_HTTPHEADER => array(
          "authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4",
          "cache-control: no-cache",
          "content-type: application/json",
          "postman-token: 10353b40-630e-ab82-849b-d6a23d7a52b2"
          ),
          ));

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err)
          echo "cURL Error #:" . $err;
          else
          echo $response;






          share|improve this answer






















          • Thank you,this is what I am looking for...
            – Magento Learner
            15 mins ago










          • can you explain a bit more on skeletonId,entity_type_id
            – Magento Learner
            2 mins ago










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244998%2fcreate-attribute-set-in-magento-2-using-api%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          Magento 2 already have an API point for creating an attribute set.



          http://www.example.com/rest/V1/products/attribute-sets


          You have to hit API point



          and have to post below value



           
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4



          Here ,here



          • skeletonId is the attribute set id on which your new attribute set
            TESTAMIT build. Here 4 is Magento default attribute set Default Id

          • "entity_type_id": 4 ,Here 4 products entity type id. Most of the time, when you want to build a new build that time system asking which attributes structure will you want to follow.

          Example at CURL



          curl -X POST 
          http://www.example.com/rest/V1/products/attribute-sets
          -H 'authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4'
          -H 'cache-control: no-cache'
          -H 'content-type: application/json'
          -H 'postman-token: 33e5dccd-7776-e22b-1a24-b484473cbe86'
          -d '
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4
          '


          PHP CURL



          <?php

          $curl = curl_init();

          curl_setopt_array($curl, array(
          CURLOPT_URL => "http://www.example.com/rest/V1/products/attribute-sets",
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => "n "attributeSet": n "attribute_set_name": "TESTAMIT",n "sort_order": 10,n "entity_type_id": 4n ,n "skeletonId": 4n",
          CURLOPT_HTTPHEADER => array(
          "authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4",
          "cache-control: no-cache",
          "content-type: application/json",
          "postman-token: 10353b40-630e-ab82-849b-d6a23d7a52b2"
          ),
          ));

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err)
          echo "cURL Error #:" . $err;
          else
          echo $response;






          share|improve this answer






















          • Thank you,this is what I am looking for...
            – Magento Learner
            15 mins ago










          • can you explain a bit more on skeletonId,entity_type_id
            – Magento Learner
            2 mins ago














          up vote
          2
          down vote



          accepted










          Magento 2 already have an API point for creating an attribute set.



          http://www.example.com/rest/V1/products/attribute-sets


          You have to hit API point



          and have to post below value



           
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4



          Here ,here



          • skeletonId is the attribute set id on which your new attribute set
            TESTAMIT build. Here 4 is Magento default attribute set Default Id

          • "entity_type_id": 4 ,Here 4 products entity type id. Most of the time, when you want to build a new build that time system asking which attributes structure will you want to follow.

          Example at CURL



          curl -X POST 
          http://www.example.com/rest/V1/products/attribute-sets
          -H 'authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4'
          -H 'cache-control: no-cache'
          -H 'content-type: application/json'
          -H 'postman-token: 33e5dccd-7776-e22b-1a24-b484473cbe86'
          -d '
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4
          '


          PHP CURL



          <?php

          $curl = curl_init();

          curl_setopt_array($curl, array(
          CURLOPT_URL => "http://www.example.com/rest/V1/products/attribute-sets",
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => "n "attributeSet": n "attribute_set_name": "TESTAMIT",n "sort_order": 10,n "entity_type_id": 4n ,n "skeletonId": 4n",
          CURLOPT_HTTPHEADER => array(
          "authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4",
          "cache-control: no-cache",
          "content-type: application/json",
          "postman-token: 10353b40-630e-ab82-849b-d6a23d7a52b2"
          ),
          ));

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err)
          echo "cURL Error #:" . $err;
          else
          echo $response;






          share|improve this answer






















          • Thank you,this is what I am looking for...
            – Magento Learner
            15 mins ago










          • can you explain a bit more on skeletonId,entity_type_id
            – Magento Learner
            2 mins ago












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          Magento 2 already have an API point for creating an attribute set.



          http://www.example.com/rest/V1/products/attribute-sets


          You have to hit API point



          and have to post below value



           
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4



          Here ,here



          • skeletonId is the attribute set id on which your new attribute set
            TESTAMIT build. Here 4 is Magento default attribute set Default Id

          • "entity_type_id": 4 ,Here 4 products entity type id. Most of the time, when you want to build a new build that time system asking which attributes structure will you want to follow.

          Example at CURL



          curl -X POST 
          http://www.example.com/rest/V1/products/attribute-sets
          -H 'authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4'
          -H 'cache-control: no-cache'
          -H 'content-type: application/json'
          -H 'postman-token: 33e5dccd-7776-e22b-1a24-b484473cbe86'
          -d '
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4
          '


          PHP CURL



          <?php

          $curl = curl_init();

          curl_setopt_array($curl, array(
          CURLOPT_URL => "http://www.example.com/rest/V1/products/attribute-sets",
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => "n "attributeSet": n "attribute_set_name": "TESTAMIT",n "sort_order": 10,n "entity_type_id": 4n ,n "skeletonId": 4n",
          CURLOPT_HTTPHEADER => array(
          "authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4",
          "cache-control: no-cache",
          "content-type: application/json",
          "postman-token: 10353b40-630e-ab82-849b-d6a23d7a52b2"
          ),
          ));

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err)
          echo "cURL Error #:" . $err;
          else
          echo $response;






          share|improve this answer














          Magento 2 already have an API point for creating an attribute set.



          http://www.example.com/rest/V1/products/attribute-sets


          You have to hit API point



          and have to post below value



           
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4



          Here ,here



          • skeletonId is the attribute set id on which your new attribute set
            TESTAMIT build. Here 4 is Magento default attribute set Default Id

          • "entity_type_id": 4 ,Here 4 products entity type id. Most of the time, when you want to build a new build that time system asking which attributes structure will you want to follow.

          Example at CURL



          curl -X POST 
          http://www.example.com/rest/V1/products/attribute-sets
          -H 'authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4'
          -H 'cache-control: no-cache'
          -H 'content-type: application/json'
          -H 'postman-token: 33e5dccd-7776-e22b-1a24-b484473cbe86'
          -d '
          "attributeSet":
          "attribute_set_name": "TESTAMIT",
          "sort_order": 10,
          "entity_type_id": 4
          ,
          "skeletonId": 4
          '


          PHP CURL



          <?php

          $curl = curl_init();

          curl_setopt_array($curl, array(
          CURLOPT_URL => "http://www.example.com/rest/V1/products/attribute-sets",
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => "n "attributeSet": n "attribute_set_name": "TESTAMIT",n "sort_order": 10,n "entity_type_id": 4n ,n "skeletonId": 4n",
          CURLOPT_HTTPHEADER => array(
          "authorization: Bearer p0jc2h1jwpha6gmje34frq9dm7x9liv4",
          "cache-control: no-cache",
          "content-type: application/json",
          "postman-token: 10353b40-630e-ab82-849b-d6a23d7a52b2"
          ),
          ));

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err)
          echo "cURL Error #:" . $err;
          else
          echo $response;







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 31 secs ago

























          answered 3 hours ago









          Amit Bera♦

          54.7k1367160




          54.7k1367160











          • Thank you,this is what I am looking for...
            – Magento Learner
            15 mins ago










          • can you explain a bit more on skeletonId,entity_type_id
            – Magento Learner
            2 mins ago
















          • Thank you,this is what I am looking for...
            – Magento Learner
            15 mins ago










          • can you explain a bit more on skeletonId,entity_type_id
            – Magento Learner
            2 mins ago















          Thank you,this is what I am looking for...
          – Magento Learner
          15 mins ago




          Thank you,this is what I am looking for...
          – Magento Learner
          15 mins ago












          can you explain a bit more on skeletonId,entity_type_id
          – Magento Learner
          2 mins ago




          can you explain a bit more on skeletonId,entity_type_id
          – Magento Learner
          2 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244998%2fcreate-attribute-set-in-magento-2-using-api%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          Installing NextGIS Connect into QGIS 3?

          One-line joke