Extend vehicle API endpoints to support all editable fields #1280 - #1300
Open
iamdabe wants to merge 3 commits into
Open
Extend vehicle API endpoints to support all editable fields #1280#1300iamdabe wants to merge 3 commits into
iamdabe wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR extend the existing
Vehiclesendpoint to include all editable fields bringing the API’s functionality in line with the UI as discussed in issue #1280The primary goal was to support adding and editing Purchase and Sold information via the API. While I was there it wasn't much effort to add the other missing fields too.
Add/Update Vehicle (
POST /api/vehicle/add,PUT /api/vehicle/update)ImageLocation,PurchaseDate,SoldDate,PurchasePrice,SoldPrice,OdometerMultiplier, andOdometerDifferencefields on theVehicleInputModelPurchaseDate,SoldDate), decimal (OdometerMultiplier), and integer (OdometerDifference) fields before attempting to apply themOdometerMultiplier="1",OdometerDifference="0",HasOdometerAdjustment=false) when fields are omitted. Update endpoint skips fields not provided for backwards compatibility.IsElectricandIsDieselpatch that resolves bug changing fuel type.Image Upload (
POST /api/images/upload)Content-Typestarts withimage/500KBwith a descriptive error (as no way to get width/height without including a 3rd party image package.LocationandNameon success, matching the existingUploadedFilesresponse pattern as used by documents upload endpointImage Upload Flow
To set a vehicle image via the API, first upload the image, then pass the returned
locationinto the vehicle add/update payload.1. Upload the image
POST /api/images/uploadMultipart form upload with the file in the
imagefield. Max 500KB.Returns:
2. Use the
locationin Add or Update VehiclePOST /api/vehicles/addPUT /api/vehicles/updateNotes
purchaseDate/soldDate— ISO 8601 date strings, optionalpurchasePrice/soldPrice— decimal, optionalodometerMultiplier/odometerDifference— if either is provided, odometer adjustment is automatically enabled on the vehicle