API Mock: Notas importantes - Socomarca/socomarca-backend GitHub Wiki

General

  • La header de autorización para los endpoints que la requieran es Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

Autenticación - dummy data

200 POST /api/auth/token

  • rut: cualquiera
  • password: "strongPassword"

401 POST /api/auth/token

  • rut: cualquiera
  • password: "wrong-password"

200 POST /api/auth/restore/code

  • rut: cualquiera excepto 111111111*

422 POST /api/auth/restore/code (RUT inválido no encontrado en la base de datos)

  • rut: 111111111

200 PUT /api/auth/restore/password

  • verification_code: 007007567
  • password: New$trongPassw0rd
  • password_confirmation: New$trongPassw0rd

422 PUT /api/auth/restore/password (código inválido)

  • verification_code: cualquiera distinto de 007007567
  • password: New$trongPassw0rd
  • password_confirmation: New$trongPassw0rd

422 PUT /api/auth/restore/password (confirmación de contraseña inválida)

  • verification_code: 007007567
  • password: Newstrongpassword
  • password_confirmation: New$trongPassw0rd

422 PUT /api/auth/restore/password (todos los campos inválidos)

  • verification_code: cualquiera distinto de 007007567
  • password: cualquiera distinto de New$trongPassw0rd
  • password_confirmation: cualquiera distinto de New$trongPassw0rd

Direcciones - dummy data

401 GET /api/addresses

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

200 GET /api/addresses

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

401 POST /api/addresses

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

422 POST /api/addresses (todos los campos inválidos)

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • body address_line1: null
  • body address_line2: null
  • body postal_code: null
  • body is_default: null
  • body type: null
  • body phone: null
  • body contact_name: null
  • body user_id: null
  • body municipality_id: null

201 POST /api/addresses

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • body address_line1: Address Street #321
  • body address_line2: Small House
  • body postal_code: 25700000
  • body is_default: true
  • body type: shipping
  • body phone: 998877665
  • body contact_name: Contact
  • body user_id: 1
  • body municipality_id: 1

401 GET /api/addresses/:id

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

422 GET /api/addresses/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: distinto de un entero

200 GET /api/addresses/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

401 PUT /api/addresses/:id

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

422 PUT /api/addresses/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: distinto de un entero

422 PUT /api/addresses/:id (todos los campos inválidos)

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1
  • body address_line1: null
  • body address_line2: null
  • body postal_code: null
  • body is_default: null
  • body type: null
  • body phone: null
  • body contact_name: null
  • body user_id: null
  • body municipality_id: null

200 PUT /api/addresses/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1
  • body address_line1: Address Street #321
  • body address_line2: Small House
  • body postal_code: 25700000
  • body is_default: true
  • body type: shipping
  • body phone: 998877665
  • body contact_name: Contact
  • body user_id: 1
  • body municipality_id: 1

401 DELETE /api/addresses/:id

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

422 DELETE /api/addresses/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: distinto de un entero

200 DELETE /api/addresses/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

Users dummy data

401 GET /api/users

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

200 GET /api/users

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

401 POST /api/users

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

422 POST /api/users (todos los campos inválidos)

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • body name: null
  • body email: null
  • body phone: null
  • body rut: null
  • body business_name: null
  • body is_active: null

201 POST /api/users

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • body name: Customer
  • body email: [email protected]
  • body phone: 998877665
  • body rut: 20987654-3
  • body business_name: Business Store
  • body is_active: true

401 GET /api/users/:id

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

422 GET /api/users/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: distinto de un entero

200 GET /api/users/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

401 PUT /api/users/:id

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

422 PUT /api/users/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: distinto de un entero

422 PUT /api/users/:id (todos los campos inválidos)

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1
  • body name: null
  • body email: null
  • body phone: null
  • body rut: null
  • body business_name: null
  • body is_active: null

200 PUT /api/users/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1
  • body name: Customer
  • body email: [email protected]
  • body phone: 998877665
  • body rut: 20987654-3
  • body business_name: Business Store
  • body is_active: true

401 DELETE /api/users/:id

  • header Authorization: distinto de Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1

422 DELETE /api/users/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: distinto de un entero

200 DELETE /api/users/:id

  • header Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • params id: 1