Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{"message":"Request does not match any route."} #1318

Closed
sivajik34 opened this issue May 30, 2015 · 3 comments
Closed

{"message":"Request does not match any route."} #1318

sivajik34 opened this issue May 30, 2015 · 3 comments

Comments

@sivajik34
Copy link
Contributor

i'm using following syntax :
curl -X POST http://localhost/magento2/index.php/rest/V1/createAccount:customers -H "Authorization: Bearer uvdhea5fwq2yu4w2lvm9o2q8u30hnq76" -H "Content-Type:application/json" -d '{
"customers": {
"customer": {
"email": "[email protected]",
"firstname": "John",
"lastname": "Doe"
},
"addresses": [
{
"defaultShipping": true,
"defaultBilling": true,
"firstname": "John",
"lastname": "Doe",
"region": {
"regionCode": "CA",
"region": "California",
"regionId": 12
},
"postcode": "90001",
"street": ["Zoe Ave"],
"city": "Los Angeles",
"telephone": "555-000-00-00",
"countryId": "US"
}
]
}
}'

can you give idea where i'm wrong

@alankent
Copy link

The route implies the verb/URL did not match. In the webapi.xml file when you see :foo it means that URL segment is mapped to an argument called foo - you don't type it in verbatim. Looking at https://github.com/magento/magento2/blob/develop/app/code/Magento/Customer/etc/webapi.xml#L119 I think you should be doing a POST to /V1/customers (I am on iPad, no laptop handy, so I have not tried it to verify - just firing a quick response off).

@sivajik34
Copy link
Contributor Author

curl -X POST http://localhost/magento2/index.php/rest/V1/customers -H "Authorization: Bearer uvdhea5fwq2yu4w2lvm9o2q8u30hnq76" -H "Content-Type:application/json" -d '{
"customers": {
"customer": {
"email": "[email protected]",
"firstname": "John",
"lastname": "Doe"
},
"addresses": [
{
"defaultShipping": true,
"defaultBilling": true,
"firstname": "John",
"lastname": "Doe",
"region": {
"regionCode": "CA",
"region": "California",
"regionId": 12
},
"postcode": "90001",
"street": ["Zoe Ave"],
"city": "Los Angeles",
"telephone": "555-000-00-00",
"countryId": "US"
}
]
}
}'
now error is:
{"message":"%fieldName is a required field.","parameters":{"fieldName":"customer"}}

@sivajik34
Copy link
Contributor Author

working fine with:
curl -X POST localhost/magento2/index.php/rest/V1/customers/ -H "Authorization: Bearer uvdhea5fwq2yu4w2lvm9o2q8u30hnq76" -H "Content-Type:application/json" -d '{

    "customer": {
        "email": "[email protected]",  
        "firstname": "John",
        "lastname": "Doe"
    },
    "addresses": [
        {
            "defaultShipping": true,
            "defaultBilling": true,
            "firstname": "John",
            "lastname": "Doe",
            "region": {
                "regionCode": "CA",
                "region": "California",
                "regionId": 12
            },
            "postcode": "90001",
            "street": ["Zoe Ave"],
            "city": "Los Angeles",
            "telephone": "555-000-00-00",
            "countryId": "US"
        }
    ]

}

magento-team pushed a commit that referenced this issue Jul 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants