Giter Club home page Giter Club logo

arboles's Introduction

Prueba Kinedu

Creación de dos end points con paginación

  1. Obtener todos los hijos del nodo enviado como parámetro en la url.

Ejemplo

 
@url = http://localhost:8000/api/v1/nodes/1/children?page=0
GET {{url}} HTTP/1.1
Accept: application/json
Content-Type: application/json


Response

HTTP/1.1 200 OK
Host: localhost:8000
Date: Sun, 11 Apr 2021 21:26:47 GMT, Sun, 11 Apr 2021 21:26:47 GMT
Connection: close
X-Powered-By: PHP/7.2.32
Cache-Control: no-cache, private
Content-Type: application/json
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
Access-Control-Allow-Origin: *

[
  {
    "id": 1,
    "name": "np",
    "parent_id": null,
    "created_at": "2021-04-10T00:16:48.000000Z",
    "updated_at": "2021-04-10T00:16:48.000000Z",
    "deleted_at": null
  },
  {
    "id": 3,
    "name": "sh1",
    "parent_id": 1,
    "created_at": "2021-04-10T00:18:23.000000Z",
    "updated_at": "2021-04-10T00:18:23.000000Z",
    "deleted_at": null
  },
  {
    "id": 4,
    "name": "c1",
    "parent_id": 3,
    "created_at": "2021-04-10T00:18:23.000000Z",
    "updated_at": "2021-04-10T00:18:23.000000Z",
    "deleted_at": null
  }
]
  1. Obtener todos los nodos padres del nodo enviado como parámetro en la url.

Ejemplo

@url = http://localhost:8000/api/v1/nodes/12/parents?page=0
GET {{url}} HTTP/1.1
Accept: application/json
Content-Type: application/json

Response

HTTP/1.1 200 OK
Host: localhost:8000
Date: Sun, 11 Apr 2021 21:28:18 GMT, Sun, 11 Apr 2021 21:28:18 GMT
Connection: close
X-Powered-By: PHP/7.2.32
Cache-Control: no-cache, private
Content-Type: application/json
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
Access-Control-Allow-Origin: *

[
  {
    "id": 12,
    "name": "hhhf2",
    "parent_id": 11,
    "created_at": 2021-04-10T00:18:23.000000Z,
    "updated_at": 2021-04-10T00:18:23.000000Z,
    "deleted_at": null
  },
  {
    "id": 11,
    "name": "hhf2",
    "parent_id": 10,
    "created_at": 2021-04-10T00:18:23.000000Z,
    "updated_at": 2021-04-10T00:18:23.000000Z,
    "deleted_at": null
  },
  {
    "id": 10,
    "name": "hf2",
    "parent_id": 8,
    "created_at": 2021-04-10T00:18:23.000000Z,
    "updated_at": 2021-04-10T00:18:23.000000Z,
    "deleted_at": null
  }
]

arboles's People

Contributors

leoairmedia avatar akirel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.