• Tim S
  • NEWBIE
  • -2 Points
  • Member since 2013
  • IT Administrator

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
Hello,

I'm using the REST API and I would like to use it to add attachments to a record in a Custom Object.  The attachments may be binary (eg jpeg, pdf and similar) or text files.

Is this possible?  I can see a way to create a document but I can't see how to then attach it to a record.

Cheers

Tim
  • October 10, 2017
  • Like
  • 0
Hello,

I am using php cURL to access my Salesforce instance using the REST API.  Without any change on my part, it stopped responding on 20th December and has not worked since then.

I have investigated and found that:

1.  The authentication step is working (goes to https://login.salesforce.com)
2.  All other requests to https://myinstance.salesforce.com/services......  fail with error 400
3.  The same requests work in REST Explorer by simply copy/paste the request line

This behaviour looks like Salesforce is rejecting anything coming from my site through the API to myinstance.salesforce.com.

Did any change take place on or about 20th December in the way REST API is called?

If Salesforce has decided that my site or ISP is a bad risk, how can I have that addressed?  I don't expect that it the case because the authentication works.

Merry Christmas to all.

Tim
  • December 24, 2016
  • Like
  • 0
Hello,

I am using REST API calls to interface my Enterprise Salesforce to several web forms.  These have been working without problems for several months.

In the last 24 hours all of these calls have failed even though I have made no change to any of the affected web forms.

The authentication step works correctly and return the expected access code but when the form makes the second call - usually to query a Salesforce Object - the php Curl call returns no response.  There is no error message, it is simply that nothing happens.

I am not using bulk of batch API - thes are calls direct from php in the web form.

This behaviour is occurring on all my web forms, and as I have said I have made no change to any of them.

Is there any advice on how I can address this matter?  It is causing serious disruption to my customers.

I am only on the Basic support package and so Salesforce Support have said they can't help.

Cheers

Tim
  • December 20, 2016
  • Like
  • 0
Hi all,

I have Salesforce Enterprise Edition and I'm trying (for the first time) to get the REST API running to allow customers on my website to retrieve information from a Custom Object.

I am using php and cURL and I have the code as follows:
 
$data = array(
           'grant_type' => 'authorization_code',
           'client_id' => '3MVG9Y6d_Btp4xp4HAFSNWODZZ3LBsvdnEgg3_mx6jFqaOPXUv4f_Jm_pBpJEBOuKiRm2dy6YmKuKcippwgDz',
           'client_secret' => '1868164969908299792',
           'redirect_uri' => 'https://www.mywebsite.com/index.php?option=com_chronoforms5&chronoform=testconnectedapp&event=return',
                   'environment' => 'https://myinstance.salesforce.com/services/oauth2/token'
       );

$form->data['data'] = $data;

$data_param = http_build_query ($data, '&');

$url = "https://myinstance.salesforce.com/services/oauth2/token";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_param);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response  = curl_exec($ch);
curl_close($ch);

I get the response:
 
[response] => {"error":"invalid_grant","error_description":"invalid authorization code"}

I am sure that the client Id and client secret are correct.  The Connected App has Relax IP Restrictions, All users may self-authorise, no timeout restriction and "Full Access" .

So I am not sure what else I can try here - can someone advise please?

Thank you

Tim 
  • August 21, 2016
  • Like
  • 0
Hello,

I have a single Custom Object which contains two record types:  Club and Member.  Members belong to clubs and are linked by a Lookup that references the Club record type.  The reason why I do it this way instead of the more usual Master-Detail is that we need to deal with reports and communications that go to both.  So we don't want them in separate Objects.

I want to be able to store the numbers of members in each club at the start of each month, for historical records.  If I had the counts in a field in the Club Record Type I could use a time trigger and a field update to store the counts in a "History" object, so I need a field (formula or summary) that holds the count.  

I can't see a way to do this, using the available formula and summary options and I am wondering if anyone can suggest a solution.

Thanks

Tim
  • November 10, 2015
  • Like
  • 0
Hello,

I am using REST API calls to interface my Enterprise Salesforce to several web forms.  These have been working without problems for several months.

In the last 24 hours all of these calls have failed even though I have made no change to any of the affected web forms.

The authentication step works correctly and return the expected access code but when the form makes the second call - usually to query a Salesforce Object - the php Curl call returns no response.  There is no error message, it is simply that nothing happens.

I am not using bulk of batch API - thes are calls direct from php in the web form.

This behaviour is occurring on all my web forms, and as I have said I have made no change to any of them.

Is there any advice on how I can address this matter?  It is causing serious disruption to my customers.

I am only on the Basic support package and so Salesforce Support have said they can't help.

Cheers

Tim
  • December 20, 2016
  • Like
  • 0
Hi all,

I have Salesforce Enterprise Edition and I'm trying (for the first time) to get the REST API running to allow customers on my website to retrieve information from a Custom Object.

I am using php and cURL and I have the code as follows:
 
$data = array(
           'grant_type' => 'authorization_code',
           'client_id' => '3MVG9Y6d_Btp4xp4HAFSNWODZZ3LBsvdnEgg3_mx6jFqaOPXUv4f_Jm_pBpJEBOuKiRm2dy6YmKuKcippwgDz',
           'client_secret' => '1868164969908299792',
           'redirect_uri' => 'https://www.mywebsite.com/index.php?option=com_chronoforms5&chronoform=testconnectedapp&event=return',
                   'environment' => 'https://myinstance.salesforce.com/services/oauth2/token'
       );

$form->data['data'] = $data;

$data_param = http_build_query ($data, '&');

$url = "https://myinstance.salesforce.com/services/oauth2/token";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_param);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response  = curl_exec($ch);
curl_close($ch);

I get the response:
 
[response] => {"error":"invalid_grant","error_description":"invalid authorization code"}

I am sure that the client Id and client secret are correct.  The Connected App has Relax IP Restrictions, All users may self-authorise, no timeout restriction and "Full Access" .

So I am not sure what else I can try here - can someone advise please?

Thank you

Tim 
  • August 21, 2016
  • Like
  • 0