General Technical Discussions for Service

Get Involved. Join the Conversation.

Topic

    Bibek Jena
    Rest API in RightNowAnswered
    Topic posted October 5, 2016 by Bibek JenaRed Ribbon: 250+ Points 
    683 Views, 8 Comments
    Title:
    Rest API in RightNow
    Content:

    Hi All,

    When I am trying to "POST" and "PATCH" the Address of Organisation through REST API,It is giving me error in both the methods.

    I tried this Request Body:

    {
    "name": "Oracle DNV Corp",
    "customFields":  
    {
          "c":     
          {
             "Did": "bkj"
          }
     },
     "customFields":  
    {
          "c":     
          {
             "namelocal": "AccountLocal"
          }
     },
     "address": {
        "city": "Boston",
         "street": "123 Beacon Street"
        }
    }

    I have used the tunnelling method in PATCH method.Can anyone guide me where I am doing wrong .

    Thanks in Advance.

    Version:
    V1.3

    Best Comment

    Scott Harwell

    The error in your screenshot explains the problem.  Your passing an invalid property "address" in your JSON.  Addresses are updated through the addresses endpoint, since there can be many of them.  If you need to add or update an address, then you'll do that through the addresses endpoint on the org.

    https://mysite.example.com/services/rest/connect/v1.3/organizations/<org_id>/addresses
    

    Also, you should consolidate your custom fields updates...

    {
            "name": "Oracle DNV Corp",
            "customFields":  
            {
                  "c":     
                  {
                     "Did": "bkj",
                     "namelocal": "AccountLocal"
                  }
             }
     }
    

    Comment

     

    • Scott Harwell

      What endpoint are you posting your call to and what is the error message that you are receiving?

    • Bibek Jena

      I have used this EndPoint:-

      https://mysite.example.com/services/rest/connect/v1.3/organizations

      I have uploaded the error that I am getting. Please have a look on it.

    • Scott Harwell

      The error in your screenshot explains the problem.  Your passing an invalid property "address" in your JSON.  Addresses are updated through the addresses endpoint, since there can be many of them.  If you need to add or update an address, then you'll do that through the addresses endpoint on the org.

      https://mysite.example.com/services/rest/connect/v1.3/organizations/<org_id>/addresses
      

      Also, you should consolidate your custom fields updates...

      {
              "name": "Oracle DNV Corp",
              "customFields":  
              {
                    "c":     
                    {
                       "Did": "bkj",
                       "namelocal": "AccountLocal"
                    }
               }
       }
      
    • BTMS

      hi, Can you help me with adding country & state in the address?

    • Suresh Thirukoti

      https://mysite.example.com/services/rest/connect/v1.4/contacts/2

      With Body

      {
      "address":{
      "country":{
      "lookupName":"US"
      },
      "stateOrProvince": {
              "lookupName": "MA"
              }
      }
      }

    • Pavel Franger

      Can anyone help updating the mobile phone field?

      /services/rest/connect/v1.3/contacts/####/phones/1/

      what do i use in the body?

      Thank you in advance. =)

      • Robert Surujbhan

        The correct JSON body payload for updating a Contact's mobile phone number is below.  The "phoneType" ID value of 1 means the "Mobile" type.

        You would need to send this just to the contact's resource ID endpoint (e.g., https://site/services/rest/connect/<version>/contacts/12345).  You can use PATCH if your network supports it, or alternatively, you can use POST by supplying the X-HTTP-Method-Override header set to "PATCH" - both should work.

        {  
           "phones":[  
              {  
                 "number":"999-555-1212",
                 "phoneType":{  
                    "id":1
                 }
              }
           ]
        }
        
        • Pavel Franger

          Thanks a lot Robert. Really appreciate it.

          I was off on the wrong foot with the endpoint url.

          Thank you again.