0

I have an integration where I need to get the agency of my endpoint. Once I have the agency this wil be used for all the rest of the callouts.

I would like some advice for the following:

  1. Is there a way to do the callout only once and save this as a custom setting.
  2. Do I need to get the agency before every put callout.
  3. Do I do a 1 time query for the current agency id and save the external ID in a custom setting?
  • Does this agency endpoint changes over the period? Will it be same for all the callouts made in that org? – Naval Sharma Oct 10 '18 at 8:40
  • @NavalSharma This will be the same for all callouts in the org – Thomas Oct 10 '18 at 8:45
0

If it is a one time process to get the setting by making a callout then you can try an external callout app like http://sfdctools.herokuapp.com/restclient.jsp to avoid any kind of Salesforce limit.

Once you receive the response parse it and store it in your custom setting. I would suggest you can store the external id field into name field of list custom setting for better performance.

If you would like my suggestion you can mark it as an answer.

0

You can write a class or call it from the developer console for once. The class will have a static method which will get the agency end-point and will save it in the custom setting. For the rest callouts, you can just get the end-point from the custom setting.

class AgencyEndPointService {
    public static updateEndPointSetting() {
        // Make a callout 
        // parse the response and save the returned end-point in a 
        // List type custom setting 
    }
}

I think using the above approach, you can update the custom setting in future if the endpoint changes.

Making a callout for a resource which is never changing is not recommended.

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.