cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9 Rest API POST create new user

Magento 1.9 Rest API POST create new user

I'm using custom Magento Rest API, to create a new user, my postman request data is:

URL: http://megashopping.am/api/rest/register/store/1

content-type: application/json

Key: firstname

but I am having this error

{
  "messages": {
    "error": [
      {
        "code": 400,
        "message": "Decoding error."
      }
    ]
  }
} 

 

My XML file is

<extendrestapiregister translate="title" module="api2">
                <group>extendrestapi</group>
                <model>extendrestapi/api2_register</model>
                <title>Register</title>
                <sort_order>10</sort_order>
                <privileges>
                    <guest>
                       <retrieve>1</retrieve>
                       <create>1</create>
                    </guest>
                </privileges>
                <attributes   >
                    <firstname>First Name</firstname>                    
                </attributes>
                <routes>
                    <route_entity>
                        <route>/register/:id/store/:store_id</route>
                        <action_type>entity</action_type>
                    </route_entity>
                    <route_collection>
                        <route>/register/store/:store_id</route>
                        <action_type>collection</action_type>
                    </route_collection>                    
                </routes>
                <versions>1</versions>
            </extendrestapiregister>

My Class is

<?php

/**
 * Override for Magento's Catalog REST API
 */
class ITology_RestApi_Model_Api2_Register_Rest_Guest_V1 extends Mage_Api2_Model_Resource {


    /**
     * Create a customer
     * @return array
     */


     public function _create(array $data) {

        return $firstName = $data['firstname'];


    }
}

 I can't find the way to check this error

1 REPLY 1

Re: Magento 1.9 Rest API POST create new user

Probably a late response but your content type is application/json when you are trying to post XML data