ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 0 replies, has 1 voice, and was last updated by  abhishek.kumar@crmit.com 11 months ago.

  • Creator
    Topic
  • #23564

    Hey Guys,

    Can I get some resources on how to do Patch and Post operations in Java for Rest Api calls in ORO Crm?
    I am using retrofit jar and both Patch as well as Post method is working fine in the sandbox but when I am trying to do the same in Java it’s throwing Bad Request Error. Steps I am following to carry out the Patch/ Post method on ORO Entity..

    1. Generating X-WSSE authorization.
    2. Setting Content-Type as “application/vnd.api+json”.
    3. Sending the Body part as String.
    4. The target endPoint URL is like localhost/api/{entity}.

    Please refer below for the Patch method I am trying to execute:


    RequestBody requestBody = RequestBody.create(MediaType.parse(“application/vnd.api+json”), msg);
    Call<List<OroClient.OroContacts>> call = client.updateContact(id, requestBody);


    @Headers({
    “Accept: application/vnd.api+json”,
    “Content-Type: application/vnd.api+json”
    })
    @PATCH(“api/contacts/{id}?format=json”)
    Call<List<OroContacts>> updateContact(@Path(“id”) String id, @Body RequestBody requestBody);

    msg is the string variable containing the Body part. Its like:

    {“data”:{“type”:”contacts”,”id”:”3″,”attributes”:{“middleName”:”FSP”}}}

    Id id the id of the contact I have to update.

    Please note the same is working fine in api/doc as well as in the Rest Client.

You must be logged in to reply to this topic.