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

By default getting API response in XML #3

Open
syedadeelalirizvi opened this issue Feb 26, 2015 · 2 comments
Open

By default getting API response in XML #3

syedadeelalirizvi opened this issue Feb 26, 2015 · 2 comments

Comments

@syedadeelalirizvi
Copy link

I am successfully able to implement this, but I have an issue be default API response is in XML format. I wanted JSON response, Can you help where I can configure response to be JSON. Thanks in advance

@mehrna
Copy link

mehrna commented Oct 12, 2015

You have to put this code in component section of your api main config file:

        'request' => [
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
            ]
        ],

@faustueb
Copy link

faustueb commented May 4, 2017

Hi i put the code above, but i have problem only when i try to get single country , i have to add ?_format=json in url after the lasrt parameter so : ..../country/ID?_format=json.
Thanks for your help

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

3 participants