function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shiva Kumar 82Shiva Kumar 82 

Insert data to a Custom Field of type text

Is there a way to insert data into a custom field of type text via SOAP or REST API.
Do we have any endpoints/header/body. 
The custom field will be under a custom object say Mycustomobject__c --> MyCustomField__c
pconpcon
Yes, you insert the same way you would insert any other data via the SOAP or REST API, you just provide the custom field name [1]

So via the rest API you would make the following call
 
curl https://YYY.salesforce.com/services/data/v20.0/sobjects/Mycustomobject__c/ -H "Authorization: Bearer XXXXX -H "Content-Type: application/json" -d "@newObject.json"

And the newObject.json file would contain
 
{
    "MyCustomField__c": "Data goes here"
}

[1] https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm
Shiva Kumar 82Shiva Kumar 82
I managed to insert data into the custom field 'MyCustomField__c' via REST. I got a success response. Is there a way to check the data on salesforce portal OR retrieve the data via REST api. what would be the endpoint . GET method header & body 
pconpcon
You can navigate to the Id of the object in Salesforce
 
https://YYY.salesforce.com/ZZZZ

or you can do a REST GET to retrieve the data
 
curl https://YYY.salesforce.com/services/data/v20.0/sobjects/Mycustomobject__c/ZZZZ -H "Authorization: Bearer XXXXX -H "Content-Type: application/json"

Where YYY is your instance name, XXXXX is your token and ZZZZ is the object's Id.

I would also recommend that you update your endpoints to user v35.0 of the api instead of v20.0