• Kushan.D.Jayathilake
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

Guys,

I have an image stored in Attachment and I want to transfer this image through a REST service. I have tried to use EncodingUtil and convert the blob to Base64 string representation and transfer through my service.

Also I have set of objects in a nested relationship. The Base64 encoded string in the child object, and when I tried to serialize the parent object through JSON.serializePretty(),  it throws the below exception.

System.LimitException: Apex heap size too large: 8693617 External entry point 

How can I overcome of this? Any ideas?

Hi,

I have exposed a custom REST service through Apex code. I have given the following curl command to get the data from the API and it works fine if passed the session id in the header.

curl https://na30.salesforce.com/services/apexrest/testservice -H 'Authorization: Bearer 00D36000000wE02!ARAAQNag09f5_h7z8_ArS_JFo6f1o9Ag4C7y201UJDlyP66MSE1YrL7brsqS5CmCOO5' -H 'X-PrettyPrint:1'

But when I tried to use the Basic HTTP authentication it gives me below error. I have encoded the username and the password with base64

curl https://na30.salesforce.com/services/apexrest/testservice -H 'Authorization: Basic <username:password>'

[ { "message" : "Session expired or invalid", "errorCode" : "INVALID_SESSION_ID" }]

What I'm doing wrong here. Do I need to make any change in the back end code as well?
Hi,

I have exposed a custom REST service through Apex code. I have given the following curl command to get the data from the API and it works fine if passed the session id in the header.

curl https://na30.salesforce.com/services/apexrest/testservice -H 'Authorization: Bearer 00D36000000wE02!ARAAQNag09f5_h7z8_ArS_JFo6f1o9Ag4C7y201UJDlyP66MSE1YrL7brsqS5CmCOO5' -H 'X-PrettyPrint:1'

But when I tried to use the Basic HTTP authentication it gives me below error. I have encoded the username and the password with base64

curl https://na30.salesforce.com/services/apexrest/testservice -H 'Authorization: Basic <username:password>'

[ { "message" : "Session expired or invalid", "errorCode" : "INVALID_SESSION_ID" }]

What I'm doing wrong here. Do I need to make any change in the back end code as well?