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

Creating a Taxon by API #8920

Closed
jarekkowol opened this issue Oct 31, 2017 · 5 comments
Closed

Creating a Taxon by API #8920

jarekkowol opened this issue Oct 31, 2017 · 5 comments
Labels
API APIs related issues and PRs. Documentation Documentation related issues and PRs - requests, fixes, proposals. Potential Bug Potential bugs or bugfixes, that needs to be reproduced.

Comments

@jarekkowol
Copy link

My request according to http://docs.sylius.org/en/latest/api/taxons.html:

curl http://localhost:8000/api/v2/taxons/ \
    -H "Authorization: Bearer NjRmNTk0OTU3YTYxY2Q4YjM0Mjk4YTAwNTRmYTRhMWJmOWU3MGM4MWY5OTJkOWU3NzdiNzJiY2E1OGJjODAwMA" \
    -H "Content-Type: application/json" \
    -X POST \
    --data '
        {
            "code": "toys"
        }
    '

Response:
{"code":400,"message":"Validation Failed","errors":{"children":{"translations":{"children":{"en_US":{"children":{"name":{},"slug":{},"description":{}}},"pl_PL":{"children":{"name":{"errors":["Prosz\u0119 poda\u0107 nazw\u0119 taksonomii."]},"slug":{"errors":["Wprowad\u017a fragment URL kategorii."]},"description":{}}},"pl":{"children":{"name":{},"slug":{},"description":{}}}}},"images":{},"code":{},"parent":{}}}}

Any idea?

@GSadee GSadee added API APIs related issues and PRs. Help Wanted Issues needing help and clarification. labels Oct 31, 2017
@igormukhingmailcom
Copy link
Contributor

Looks like you should specify name and slug.

@jarekkowol
Copy link
Author

jarekkowol commented Nov 4, 2017 via email

@GSadee
Copy link
Member

GSadee commented Nov 6, 2017

Even if you do sth like that?:

$ curl http://demo.sylius.org/api/v1/taxons/ \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json" \
    -X POST \
    --data '
        {
            "code":"toys",
            "translations":{
                "en_US": {
                    "name": "Toys",
                    "slug": "category/toys"
                }
            }
        }
    '

Edited by @lchrusciel: Removed [ from the code snippet

@lchrusciel
Copy link
Member

Name and slug in the default locale is always required. We should update the docs probably. And @GSadee proposal should work.

@lchrusciel lchrusciel added Potential Bug Potential bugs or bugfixes, that needs to be reproduced. Documentation Documentation related issues and PRs - requests, fixes, proposals. and removed Help Wanted Issues needing help and clarification. labels Nov 7, 2017
@pamil
Copy link
Contributor

pamil commented Oct 2, 2018

Fixed by #9755.

@pamil pamil closed this as completed Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs. Documentation Documentation related issues and PRs - requests, fixes, proposals. Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

No branches or pull requests

5 participants