• Anil Kulkarni 67
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Not able to create a Custom object using REST API. Below is the C# code.

                dynamic account = new ExpandoObject();
                account.Name = "Custom Object";
                account.Description = "New Salesforce Integration";

                string endpoint = instanceUrl + "/services/data/v36.0/sobjects/CustomObject__c";                

                using (var httpClient = new HttpClient())
                {
                    using (var httpRequest = new HttpRequestMessage(HttpMethod.Post, endpoint))
                    {
                        httpRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

                        httpRequest.Content = new StringContent(JsonConvert.SerializeObject(account), Encoding.UTF8, "application/json");
                        using (var httpResponse = await httpClient.SendAsync(httpRequest))
                        {
                            if (httpResponse.IsSuccessStatusCode)
                            {
                                var response = await httpResponse.Content.ReadAsStringAsync();
                                var result = serializer.Deserialize<Dictionary<string, object>>(response);                               
                            }

                            string errorResult = await httpResponse.Content.ReadAsStringAsync();
                            jsonObject = serializer.Deserialize<Dictionary<string, object>>(errorResult);                           
                        }
                    }
                }

I always get error result as  "Requested object not found", since there is no custom object created yet in salesforce.
I would like to know how to create Custom Object in Salesforce using REST API.
I am building a new package for salesforce which connects with my external application.

I would like to create a new user(or some other possible way) in Salesforce that connects with my external application when the package is installed, and I can pass information from the external application to salesforce and I can post my updates in salesforce chatter as application updates.
I am building a new package for salesforce which connects with my external application.

I would like to create a new user(or some other possible way) in Salesforce that connects with my external application when the package is installed, and I can pass information from the external application to salesforce and I can post my updates in salesforce chatter as application updates.