Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update an Admin through the API #80

Merged
merged 1 commit into from
Feb 3, 2017
Merged

Update an Admin through the API #80

merged 1 commit into from
Feb 3, 2017

Conversation

gibarsin
Copy link
Collaborator

@gibarsin gibarsin commented Feb 3, 2017

Summary

To update an admin, POST to /api/v1/admins/{dni} with dni as the variable. The firstName and the lastName are obligatory, with the following constraints for both of them:

  • NotNull()
  • Size(min=2, max=50)

Additionally, you can update the birthday, which requires the date to be in YYYY-MM-DD format or otherwise it will be set to null, and the genre in M or F literally, otherwise it will be set to null. The address is obligatory and needs the following data:

  • street
  • city
  • country
  • neighborhood
  • number

Example

Access with POST to /api/v1/admins/382123123 with JSON request body:

{"firstName": "Juan", "lastName": "Pascale", "birthday":"1994-03-18", "genre": "M",
"address": {"street":"alalala", "city":"bsas", "country":"Arg", "neighborhood":"la lucila", "number":"23"}
}

The response should be a 204 No content because the constraints are fulfilled. Otherwise it will return a 400 Bad Request with the errors in a JSON response.

Trello Card

https://trello.com/c/sdSV4Z11/16-migrate-admincontroller

@gibarsin gibarsin merged commit d0e9d74 into development Feb 3, 2017
@gibarsin gibarsin deleted the adminsUpdate branch February 3, 2017 04:41
MatiasComercio pushed a commit that referenced this pull request Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants