title: Passing a class object as a parameter in Postman
body: <p>i am developing an API application, however I am having difficulties with a particular method.</p>
  <p>The <code>getCertificationPOJO</code> method, is responsible for taking in a Store as a parameter and searching if that store exists in the database.</p>
  <p>Now the problem here is how do <strong>I pass a Store object as a parameter in Postman.</strong> I have tried passing it in as a JSON string, but that is not working.</p>
  <p>Apologies for the bad edit</p>
  <p><strong>Certification Controller</strong></p>
  <pre><code>@Controller
  public class CertController {
  
      @Autowired
      private CertificationRepository certRepo;
      @Autowired
      private StoreRepository StoreRepository;
  
      
      @GetMapping(value = &quot;/getCertObject&quot;)
      public @ResponseBody
      Optional&lt;Certification&gt; getCertificationPOJO(@RequestParam Store store)
      {return Lists.newArrayList(certRepo.findAll()).stream().filter(e-&gt;e.getStore() == store).findFirst();}
  
  }
  </code></pre>
  <p><strong>Store Class</strong></p>
  <pre><code>@Entity
  @Table(name = &quot;store&quot;)
  public class Store implements com.halal.abstractions.Entity {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private long id;
  
      @JsonIgnore
      @OneToOne(optional = true) // By default this is set to true so technically this is redundant but, yea lets
                                 // just keep it there
      private Certification certification;
  
      @NotNull
      @Column(nullable = false)
      private String name;
  
      private String phoneNumber;
  
      @NotNull
      @Column(nullable = false)
      private String address;
  
      @NotNull
      @Column(nullable = false)
      private double latitude;
  
      @NotNull
      @Column(nullable = false)
      private double longitude;
  
      @NotNull
      @Column(nullable = false)
      private Date dateAdded;
  
      static final DateFormat DF = new SimpleDateFormat(&quot;dd/MM/yyyy&quot;);
  
      protected Store() {
      }
  
      public Store(String name, String phoneNumber, String address, double latitude, double longitude) {
          this.name = name;
          this.setPhoneNumber(phoneNumber);
          this.setAddress(address);
          this.latitude = latitude;
          this.longitude = longitude;
          this.dateAdded = new Date(System.currentTimeMillis());
      }
      @Override
      public Long getId() {
          return this.id;
      }
      @Override
      public void setId(long id) {
          this.id = id;
      }
      @Override
      public String getName() {
          return name;
      }
      @Override
      public void setName(String name) {
          this.name = name;
      }
  
      public String getAddress() {
          return address;
      }
  
      public void setAddress(String address) {
          this.address = address;
      }
  
      public String getPhoneNumber() {
          return phoneNumber;
      }
  
      public void setPhoneNumber(String phoneNumber) {
          this.phoneNumber = phoneNumber;
      }
  
      public Double getLatitude() {
          return this.latitude;
      }
  
      public void setLatitude(double latitude) {
          this.latitude = latitude;
      }
  
      public Double getLongitude() {
          return this.longitude;
      }
  
      public void setLongitude(double longitude) {
          this.longitude = longitude;
      }
  
      @Override
      public String getDateAdded() {
          return DF.format(dateAdded);
      }
  
      @Override
      public void setCertification(Certification certification) {
          this.certification = certification;
      }
      @Override
      public Certification getCertification() {
          return this.certification;
      }
  
      @Override
      public String toString() {
          return &quot;Store{&quot; + &quot;id=&quot; + id + &quot;, certification=&quot; + certification + &quot;, name='&quot; + name + '\'' + &quot;, phoneNumber='&quot;
                  + phoneNumber + '\'' + &quot;, address='&quot; + address + '\'' + &quot;, latitude=&quot; + latitude + &quot;, longitude=&quot;
                  + longitude + &quot;, dateAdded=&quot; + dateAdded + '}';
      }
  }
  </code></pre>
  <p><strong>Certification Class</strong></p>
  <pre><code>@Entity
  @Table(name = &quot;certification&quot;)
  public class Certification {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private long id;
  
      @NotNull
      @Column(nullable = false)
      private boolean isCertified;
  
      @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
      @JoinColumn(name = &quot;id&quot;)
      @JsonIgnore
      private Store store;
  
      public Certification() {
      }
  
      public long getId() {
          return this.id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      public Store getStore() {
          return this.store;
      }
  
      public void setStore(Store store) {
          this.store = store;
      }
  
      public boolean isIsCertified() {
          return this.isCertified;
      }
  
      public void setIsCertified(boolean isCertified) {
          this.isCertified = isCertified;
      }
  
      @Override
      public String toString() {
          return &quot;Certification{&quot; + &quot;id=&quot; + id + &quot;, isCertified= &quot; + isCertified + '}';
      }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Hjjis.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hjjis.png" alt="Postman Screenshot" /></a></p>