Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 22 2019 17:26

    nateiler on 2.1.0

    (compare)

  • Nov 22 2019 17:26

    nateiler on master

    adding logging via config trying to reduce the excessive … 2.1 prep and 1 more (compare)

  • Nov 22 2019 17:23

    nateiler on develop

    2.1 prep (compare)

  • Nov 21 2019 22:52

    nateiler on develop

    trying to reduce the excessive … (compare)

  • Nov 21 2019 22:39

    nateiler on develop

    adding logging via config (compare)

  • Apr 26 2019 16:55

    nateiler on master

    Update README.md (compare)

  • Apr 26 2019 16:54

    nateiler on master

    Update README.md (compare)

  • Jan 10 2019 19:27

    nateiler on 2.0.0

    (compare)

  • Jan 10 2019 19:13

    nateiler on master

    2.0.0 (compare)

  • Jan 10 2019 19:13

    nateiler on develop

    2.0.0 (compare)

  • Mar 22 2018 20:48

    nateiler on 2.0.0-rc.4

    (compare)

  • Mar 22 2018 20:48

    nateiler on master

    Adding JsonParser to recursivel… Added UrlRule Merge branch 'master' into deve… and 1 more (compare)

  • Mar 22 2018 20:47

    nateiler on develop

    2.0.0-rc.4 (compare)

  • Mar 22 2018 20:43

    nateiler on develop

    Adding JsonParser to recursivel… Bumping version. Fixing formatting and 4 more (compare)

  • Mar 22 2018 19:00

    nateiler on develop

    Added UrlRule (compare)

  • Feb 28 2018 22:37

    dsmrt on 2.0.0-rc.3

    (compare)

  • Feb 28 2018 22:36

    dsmrt on json-parser

    (compare)

  • Feb 28 2018 22:36

    dsmrt on master

    Removing key completely, when t… Merge pull request #4 from flip… (compare)

  • Feb 28 2018 22:36
    dsmrt closed #4
  • Feb 28 2018 22:32
    dsmrt opened #4
Rafael Mora
@titanve
image.png
and also I can see this when I require the rest.php file flipbox
image.png
can someone help me with that error?
Thank you in advance
Nate Iler
@nateiler
Hi Rafael, we have a starter project that might help you get up and going quickly: https://github.com/flipboxlabs/craft-restful-project

image.png

It seems you're hitting an endpoint that doesn't exist. The RESTful configuration is getting loaded (error is in JSON) but what you requested and the routes configured do not match up.

image.png

I would make sure you run composer install as it seems one of the root files isn't available for your project.

Rafael Mora
@titanve
Hello Nate, where should I run composer install?
Nate Iler
@nateiler
You'll want to run that via command line / terminal
Rafael Mora
@titanve
I know, but where?
what directory should I be in?
craft installation directory?
this is my composer.json:
{ "require": { "craftcms/cms": "3.3.13", "craftcms/redactor": "2.4.0", "edenspiekermann/craft-jwt-auth": "0.2.0", "flipboxfactory/craft-restful": "^2.0.2", "lcobucci/jwt": "^3.3", "nystudio107/craft-seomatic": "3.2.31", "solspace/craft-freeform": "3.5.3", "vlucas/phpdotenv": "^2.4.0" }, "repositories": [ { "type":"path", "url": "plugins/craft-restful-2.0.2" }, { "type": "path", "url": "plugins/craft-restful" } ], "autoload": { "psr-4": { "modules\\": "modules/", "demarkets\\": "modules/nextcraftjwt" } }, "config": { "sort-packages": true, "optimize-autoloader": true, "platform": { "php": "7.0" } }, "scripts": { "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ] } }
Nate Iler
@nateiler
The same directory as your composer.json file.
Rafael Mora
@titanve
I did it and I got: `Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 0 installs, 2 updates, 0 removals
  • Downgrading craftcms/cms (3.3.14 => 3.3.13): Downloading (100%)
  • Downgrading voku/anti-xss (4.1.16 => 4.1.15): Downloading (100%)
    Generating optimized autoload files
    Carbon 1 is deprecated, see how to migrate to Carbon 2.
    https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.`
I have this two packages installed on vendor:
image.png
Rafael Mora
@titanve
I'm using Nginx btw
Nate Iler
@nateiler
@titanve Have you pulled down the sample project and is it working correctly: https://github.com/flipboxlabs/craft-restful-project
Rafael Mora
@titanve
I installed the dependencies and made the config, but not the project itself. I will do it.
Rafael Mora
@titanve
my problem is here: return \craft\helpers\ArrayHelper::merge( $config, require(dirname(__DIR__).'/vendor/flipboxfactory/craft-rest/config/rest.php') );
Rafael Mora
@titanve
@nateiler I installed the project as suggested in a new location and I get the same result:
image.png
please help me
@nateiler
do you offer paid support?
Rafael Mora
@titanve
I think the api is working but how do I get the info in json format:
image.png
Nate Iler
@nateiler
@titanve JSON should be the default return type; but try passing`Accept: application/json' in the header to see if that helps
Rafael Mora
@titanve
@nateiler thank you!
Rafael Mora
@titanve
Hello everyone! I need to ADD/CREATE a new entry use craft\elements\Entry; of a custom type (is a channel). I am able to GETfrom the endpoint but when I try POST I get: { "name": "Internal Server Error", "message": "An internal server error occurred.", "code": 0, "status": 500 }
Rafael Mora
@titanve
I have this function: protected function newElement(array $config = []): ElementInterface { // return new User(); return new Entry(); } and if I use return new User(); I get: [ { "key": "username", "errors": [ "Username cannot be blank." ] }, { "key": "email", "errors": [ "Email cannot be blank." ] } ] so the problem is the return new Entry();
what can I do?
Thanks
Nate Iler
@nateiler
It based on the errors, the User element does not have a populated username/email. Those are validation errors from required fields in Craft.
Nate Iler
@nateiler
It's difficult to troubleshoot your specific scenario without seeing some code. Is there a way you can share some of your code? An API can be setup in a variety of ways; some examples help.
Rafael Mora
@titanve
hello Nate, yes I can share
protected function newElement(array $config = []): ElementInterface { // return new User(); return new Entry(); }
Rafael Mora
@titanve
is there a way to have more support? I really need to make the api..
Rafael Mora
@titanve
the thing is that I want to do an api for a channel element
Rafael Mora
@titanve
Hello everyone!
I'm receiving a 405 error "method not allowed" when I try to do a PUT
what could be wrong? I'm using nginx
image.png
Vakil singh
@aulkh
how to config jwt in rest api?
Vakil singh
@aulkh
send username and password get token via api?
Nate Iler
@nateiler
If you're looking to allow the API to 'login' a user, you'll need to build an endpoint to handle authorization. Once authorized, you should be able to issue and return a token based on the example above.