PATCH API IN SPRINGBOOT | Product Management System

Published: 22 May 2023
on channel: Udhav Tech
35
0

Hi Guys, today we will be creating a Patch API in springboot and saving the json data directly to Mongo DB, let's start.

Json used :-

{
"products": [
{
"productId": 1,
"SKU": "HEH-2245",
"title": "iPhone 9",
"description": "An apple mobile which is nothing like apple",
"price": 549,
"discountPercentage": 12.96,
"stock": 94,
"brand": "Apple",
"category": "smartphones",
"badges": "Exclusive|Clearance",
"avgRating": 4.5,
"rating": 10,
"inventoryCount": 8,
"createdDate": "2018-03-20 22:24:21"
},
{
"productId": 2,
"SKU": "HEH-2245",
"title": "iPhone 9",
"description": "An apple mobile which is nothing like apple",
"price": 549,
"discountPercentage": 12.96,
"stock": 94,
"brand": "Apple",
"category": "smartphones",
"badges": "Exclusive|Clearance",
"avgRating": 4.5,
"rating": 10,
"inventoryCount": 8,
"createdDate": "2018-03-20 22:24:21"
}
]
}

Entity :-

import com.fasterxml.jackson.annotation.JsonProperty;


public class ProductDTO {
@JsonProperty("productId")
private int productId;

@JsonProperty("SKU")
private String SKU;

private String title;
private String description;
private double price;

@JsonProperty("discountPercentage")
private double discountPercentage;

private double rating;
private int stock;
private String brand;
private String category;
private String Badges;

@JsonProperty("Rating Avg")
private double ratingAvg;

@JsonProperty("Rating Count")
private int ratingCount;

@JsonProperty("Inventory Count")
private int inventoryCount;

@JsonProperty("Date Created")
private String dateCreated;

// Getters and setters (or lombok annotations) can be added here
}

Config :-

spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=baeldung
spring.data.mongodb.username=admin
spring.data.mongodb.password=password

Github Link : https://github.com/Udhav-Saraswat/Pro...

restapi #rest #post #postmethod #httppost #postinrest #whatispostmethod #postrequest #postapi #postapimethod #postapiexplain #postapitutorial #basicsofpostapi #whentousepost #httpmethods #restapitutorial #restapicourse #sudocode #yogita #restapibasics #restapitutorials #whatarerestapis #whatisrest #restapiexplained #pathparametersinpost #requestpayload #responsepost #statuscode #httpcode #httpstatuscodes

mongodb #mongodb #mongo #mongodbtutorial #mongodbatlas #whatismongodb #mongod #mongodbnosql #mongosh #mongodbbasics #mongodbnodejs #installmongodb #mongonode #mongodbatlas #cursomongodb #runmongodbserverfromcommandprompt #mongodbulbitv #mongodbnodejs #apikeymongodb #mongodbjava #mongodbtutorial #чтотакоеmongodb #mongodbinjection #mongodbуроки #cursomongodb #mongodbshell #guiaapikeymongodb #mongodbcourse

whatisproductmanagement #introductiontoproductmanagement #productmanagement #introductiontoproductmanagementcourse #introtoproductmanagement #productmanagementforbeginners #productmanagementtutorial #productmanagementfundamentals #productmanagementbasics #beginnersguidetoproductmanagement #productmanagementjobs #gettingstartedwithproductmanagement #explainproductmanagement #whatisproductmanagementimportanceofproductmanagement


On this page of the site you can watch the video online PATCH API IN SPRINGBOOT | Product Management System with a duration of hours minute second in good quality, which was uploaded by the user Udhav Tech 22 May 2023, share the link with friends and acquaintances, this video has already been watched 35 times on youtube and it was liked by 0 viewers. Enjoy your viewing!