ssossossosso

Forums

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

This topic contains 25 replies, has 2 voices, and was last updated by Mike Kudelya Mike Kudelya 1 year ago.

  • Creator
    Topic
  • #23099

    Hi guys,

    While I was using Sandbox for querying account details, I am getting no contacts(child objects) related to the account despite related contacts are still there. I am using Community Portal and the request I am giving using the type:plain in api/doc. Help would be appreciated.

    Below is the response I am getting:

    “name”: “A. L. Price”,
    “createdAt”: “2016-08-31T08:26:51+00:00”,
    “updatedAt”: “2016-10-05T05:57:31+00:00”,
    “owner”: “gene.william_86ce0”,
    “contacts”: {},
    “defaultContact”: “Mr. Jerry Coleman”,
    “organization”: “CRMIT”,
    “referredBy”: null,
    “OpportunityDetails”: {}

Viewing 15 replies - 1 through 15 (of 25 total)
  • Author
    Replies
  • #23164
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi,

    What version of oro are you using ? I have tried your case on 1.10.6, sandbox returned me contacts. Does orocrm_account_to_contact contain relations ? My Account edit page, api response.

    #23168

    I am using this endPointURL : api/rest/latest/accounts and how can I use filter and sort while querying?

    #23169

    And I am not able to get a response when using this endPointURL : localhost/api/accounts?filter[id]=12 from my Java Code, I am using retrofit library??

    #23170

    And I am not able to get a response when using this endPointURL : localhost/api/accounts?filter[id]=12 from my Java Code, I am using retrofit library??

    #23179
    Mike Kudelya
    Mike Kudelya
    Oro Core

    When you are trying localhost/api/accounts url, does it return any response ?
    Try to get response via curl, here i described how you can do it.

    #23563

    Thanks Mike Kudelya for help on this topic.

    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.

    #23571
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi

    I am not familiar with java and android, but as i understood when you got ‘Bad Request’, api call hasn’t been done, request is forming before call. I think you should check our configuration of retrofit. Correct me if i’m wrong.

    I would like to say that if you want to determine any errors on oro side you should look at oro logs (/app/logs) If there won’t success i suggest you install xdebug and check patchAction. Also i can deep inside $processor->process(..)

    #23572

    Hi

    From where I can go through the configuration of retrofit done for ORO?

    #23573

    Hi,

    I went through the app/logs and I am getting this error message: Invalid json message received
    What’s wrong with my json message?

    #23576
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Replace 119 line of /vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/EventListener/BodyListener.php and set:

    instead:

    Please show me full exception message with $content variable.

    #23611

    The message for $content is :

    Invalid json message received <\”{\\\”data\\\”:{\\\”type\\\”:\\\”contacts\\\”,\\\”id\\\”:\\\”3\\\”,\\\”attributes\\\”:{\\\”middleName\\\”:\\\”FSP\\\”}}}\”>

    #23615

    One more thing Mike, do we need to send JsonArray or JsonObject?

    #23616
    Mike Kudelya
    Mike Kudelya
    Oro Core

    When i print $content variable

    result is:

    content: <{“data”:{“type”:”contacts”,”id”:”1″,”attributes”:{“middleName”:”FSP3″}}}>

    maybe in your json contains extra slash \
    try to remove it before $decoder->decode($content); call:

    #23619
    Mike Kudelya
    Mike Kudelya
    Oro Core

    One more thing Mike, do we need to send JsonArray or JsonObject?

    In my case it is object

    #23621

    Thanks Mike, I will just check whether it is working or not and let you know ASAP?

    By the way, at what time slot you are able to go through these queries?

Viewing 15 replies - 1 through 15 (of 25 total)

You must be logged in to reply to this topic.