1

When should one use Named Credentials and when Remote site settings for making REST callouts from salesforce ? Is it fine to store clientId and clientSecret in custom labels ? When using remote site setting, i need to use custom settings as well to store endpoint and resouce (URI), so that i dont need to hardcode URI in apex class.

1

they both are totally different things. Remote site setting is just a way of notify Salesforce that we are making request to this server to get and post the data. Allow(authorize) us to do so.

Where Named credentials is your token using that the external application will know that this is person x and we need to do following things. you will need both things to make a successful request.

Insteadd of custom labels you should go with hierarchical custom settings. because normally we use custom settings to store these types of information.

  • since resource names were different, these were different rows in custom setting. client id and secret were same for all the different services exposed by same endpoint. hence thought of putting them in labels. With named credentials, i think we do not need to use remote site settings ? – Walker Jun 17 '16 at 2:45
  • if you are making http request you will need to put that end point in remote site setting. otherwise you will get exception. You can create fields on custom setting then create single row of record with all values. – Tushar Sharma Jun 17 '16 at 4:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.