Skip to content

API Licenses

Christoffer Rødvik edited this page Jan 19, 2016 · 11 revisions

POST /licenses

  • Stores a new license with the provided payload.
  • Admins can create a license record on behalf of a user.

GET /licenses

  • Returns an index array of licenses belonging to the authenticated user.
  • Add role:admin to the header to be able to list out all licenses in the system.

GET /licenses/:id

  • Returns a single license record based on provided :id.
  • Admins can view any license, users can only view licenses under their accounts.

PUT /licenses/:id

  • Updates a license with the provided payload.
  • Admins can update a license on behalf of a user.
  • If updating the photo remember to delete the previous photo beforehand.

DEL /licenses/:id

  • Deletes a license record from the database.
  • Remember to delete the license photo beforehand.

WaiveCar has driver license hooks set up for photo uploads used to verify a license. To upload a photo you will be using the file module and provide the file upload with a license hook.

POST /files?licenseId={number}

{
  "files"   : "...",
  "private" : true,
  "name"    : "license-{userId}"
}

GET /files/:id

Once a photo has been uploaded to a license, the license will contain a fileId. Use this id in the get request to retrieve the license photo.

DEL /files/:id?licenseId={number}

Before deleting a license or wish to update the license photo, its important to delete the previous license photo before hand. This is not an automatic process in the API and if you delete or upload a new photo without removing the old one, the previous photo will remain in storage.

The available license payload values for POST and PUT requests.

{
  "userId"     : "",
  "number"     : "",
  "firstName"  : "",
  "middleName" : "",
  "lastName"   : "",
  "birthDate"  : "YYYY-MM-DD",
  "country"    : "",
  "state"      : ""
}
Clone this wiki locally