How to create REST API using views in Drupal 9 | Drupal 10

Поділитися
Вставка
  • Опубліковано 9 лис 2024

КОМЕНТАРІ • 11

  • @ViktorBogutskii
    @ViktorBogutskii Рік тому

    Cool! Also, the preview shows special characters, but on real request - raw data as expected. Thanks for short demo

  • @rubenescudero00
    @rubenescudero00 11 місяців тому

    Do you know how I could document this view with swagger or something similar?

  • @npnguyen
    @npnguyen 6 місяців тому

    Hi sir, How can filter by title node?

    • @drupal-academy
      @drupal-academy  6 місяців тому

      1. Edit your view and add filter criteria for the node title field.
      2.Configure the filter to expose it to the REST API by checking the "Expose this filter to visitors, to allow them to change it" option.
      3. Select Filter type to expose as "Single filter"
      4. In Operators select "Contains any word"
      5. Save your view.
      6. Access your API with end point like this : /api/employee/?title=loren%20ipsun
      Here you can see, I have passed title with node title in query parameter.
      I hope this will be helpful to you.

    • @npnguyen
      @npnguyen 6 місяців тому

      @@drupal-academy Thanks you sir, this helped me a lot

  • @SholikulHuda
    @SholikulHuda Рік тому

    how to make those API only available for authenticated users or roles based users only?
    I try to choose Access Roles, but in postman i got 403 Forbidden error

  • @erhimanshuraj298
    @erhimanshuraj298 Рік тому

    But we can pass Dynamically id

    • @drupal-academy
      @drupal-academy  Рік тому

      Yes, If you have watched full video. I passed dynamic node Id.

    • @erhimanshuraj298
      @erhimanshuraj298 Рік тому

      @@drupal-academy can you share full video link

    • @drupal-academy
      @drupal-academy  Рік тому

      It is in same video. Starts at 6:09.