by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 04 10:10
    cundd commented #65
  • Jul 31 10:09
    cundd commented #65
  • Jul 31 10:01
    r3h6 opened #65
  • Jun 16 12:42

    cundd on v4

    Add support for `REDIRECT_TYPO3… (compare)

  • Jun 15 08:59

    cundd on v4

    Raise version number to 4.1.0-d… Replace tabs with spaces Add support to specify a Expire… and 2 more (compare)

  • Jun 09 13:12

    cundd on expires-header-config

    Fix a bug where wrong config-ke… (compare)

  • Jun 01 10:08
    cundd closed #64
  • Jun 01 10:01
    issibi commented #64
  • Jun 01 09:49
    cundd commented #64
  • May 30 21:47
    issibi opened #64
  • Apr 20 10:13
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 10:13
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 10:12
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 10:09
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 10:09
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 10:09
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 10:08
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 10:07
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 10:07
    Travis cundd/rest (3.6.1) passed (612)
  • Apr 20 08:00
    sneopu commented #63
marc-munos
@marc-munos
Hi everybody,
Is there a way to limit the results of virtual objects without implementing a custom handler ?
Ty
Daniel Corn
@cundd
Hi @marc-munos
No unfortunately that's not implemented yet
marc-munos
@marc-munos
@cundd Ok, ty. This is a great extension, ty & congratulation.
Daniel Corn
@cundd
Thanks a lot :)
SamVictor
@victorvicky
Hi
Good Day
Hai
How can we use condtional statements in markers in typo3?
Thanks in advance
jan-runkel-zeitgleich
@jan-runkel-zeitgleich
hi i have a problem with the TYPO3_REST_REQUEST_BASE_PATH varibale. In my case TYPO3 start at subfolder like "backend/web". i set in the Apache the Path: SetEnv TYPO3_REST_REQUEST_BASE_PATH backend/web/ and apache redirect to the subfolder and change the variable to REDIRECTED_TYPO3_REST_REQUEST_BASE_PATH
can we add this sipped to the extension?
image.png
Daniel Corn
@cundd
Hi @jan-runkel-zeitgleich thank you for the suggestion. I'm not sure if the change would be a general improvement. Do you have an idea where/why Apache modifies the Env-Variable name?
jan-runkel-zeitgleich
@jan-runkel-zeitgleich
looks like a general problem
This is the way from TYPO3 to handle the TYPO3_CONTEXT var with REDIRECT_TYPO3_CONTEXT
$restRequestBasePath = (string)getenv('TYPO3_REST_REQUEST_BASE_PATH') ?: (string)(getenv('REDIRECT_TYPO3_REST_REQUEST_BASE_PATH'));
this would be the solution?
Daniel Corn
@cundd
:D ok I give up!
I'll have to check regarding the type cast
Maybe it needs to be
$restRequestBasePath = (string)(getenv('TYPO3_REST_REQUEST_BASE_PATH') ?: (getenv('REDIRECT_TYPO3_REST_REQUEST_BASE_PATH')));
jan-runkel-zeitgleich
@jan-runkel-zeitgleich
we need this in ext_localconf.php and ReqeustFactory.php (L:185)
:)
Daniel Corn
@cundd
$restRequestBasePath = (string)(getenv('TYPO3_REST_REQUEST_BASE_PATH') ?: getenv('REDIRECT_TYPO3_REST_REQUEST_BASE_PATH'));
This one should work
jan-runkel-zeitgleich
@jan-runkel-zeitgleich
yes
Daniel Corn
@cundd
I'll have a look at it in the afternoon.
jan-runkel-zeitgleich
@jan-runkel-zeitgleich
thanks
Daniel Corn
@cundd
You're on version 4, correct?
jan-runkel-zeitgleich
@jan-runkel-zeitgleich
yes
4.0.0
Daniel Corn
@cundd
:+1:
Daniel Corn
@cundd
I pushed the change to github
jan-runkel-zeitgleich
@jan-runkel-zeitgleich
thanks
miguel
@miguel1995

Hi Daniel, I have an error with CORS when I call form different origins, except in my local postman. When I send a GET it's ok, but not in POST.
"Access to fetch at 'http://mydomain.com/rest/eventos/mymodel' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status."

-->This is configuration in TYPOSCRIPT:

plugin.tx_rest.settings {
 responseHeaders {                
    Access-Control-Allow-Origin = *
Access-Control-Allow-Methods = POST, GET, OPTIONS
      Access-Control-Allow-Headers = Content-Type 
 }  
}
plugin.tx_rest.settings.paths {
 1 {
    path = unal-unal_circular-circurlarEvent
    read = allow
    write = allow
    handlerClass = \UNAL\UnalCircular\Rest\EventHandler
 }
}

--> This is my configuration in .htacces :
...
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Allow-Headers "append,delete,entries,foreach,get,has,keys,set,values,Authorization"
...

Daniel Corn
@cundd
Hi @miguel1995! I think the problem is that the preflight (=OPTIONS) request doesn’t receive an Ok response. Is there a route for OPTIONS in your handler?
And it’s possible that you need a OPTIONS route for every URI path you send a POST to
miguel
@miguel1995
Hi @cundd I don't have a route for OPTIONS in my handler. Can you give me an example of some implementation?, please .
Daniel Corn
@cundd
Hi @miguel1995 that’s quite simple. Have a look at https://github.com/cundd/rest/blob/v4/Classes/Handler/CrudHandler.php#L203
miguel
@miguel1995

Hello Daniel.
I want to thank you for your quick responses.

I could already create the OPTIONS path with the example you gave me. I can consume my POST service without problems. I tried Jquery and javascript fetch and everything works fine. :)
But this only works if I make the POST without headers.

When I add any header, for example : headers:{ 'Content-Type': 'application/json' } it doesn't work and it returns an error:

"... has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response."

Do you have any idea?
Daniel Corn
@cundd
When you make a CORS request (from http://webapp-domain:port to http://api-domain:port) you also have to explicitly allow which headers can be sent.
I usually add something like the following TypoScript:
plugin.tx_rest.settings {
    # Overwrite the response's headers with the following ones
    responseHeaders {
        # Allow the client to send a `Content-Type` header for requests
        Access-Control-Allow-Headers = Content-Type
    }
}
If you need more fine-grained control, it should also be possible to return a Response from you Options-route (instead of only saying return true;)
Tamasu
@xTamasu
Hi, I cant get the extension to work. How can I call a table with all feusers in it? I want to get/post/update/delete feusers with this rest api. It should be called via mydomain.com/rest/feusers. Where should I start? I already installed it and was greeted with {"message":"Good Morning!"} at /rest/
Daniel Corn
@cundd
@xTamasu the next step will be to create a resource-definition like in https://rest.corn.rest/Configuration/Basic/#namespaces-and-vendor-prefix
The model you are looking for will most likely be \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
Tamasu
@xTamasu

So I created an own extension and added setup.ts with
company_ext_programrestapi-users { path = typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php read = allow write = allow }

But now it throws errors, I think I configured the wrong path. Is there a way I can access internal models? (relative new to typo3)

Daniel Corn
@cundd
oh. sorry I forgot, that it currently does not work out of the box with internal objects (because the resource-path can not be created for the deeply nested namespaces like \TYPO3\CMS\Extbase
but you can check out https://rest.corn.rest/Customize/ and fetch the FeUsers in your handler
Daniel Corn
@cundd
The problem with TYPO3's own classes is, that the vendor basically has two parts TYPO3 and CMS followed by the extension name. The REST extension must be able to take the request path and split it up into vendor and model, but it also needs to support deeper nested models (e.g. Vendor\NiceExtension\Domain\Model\Product\GroupedProduct)