# Step 2: Write Apex to Send an HTTP Call to the Connected App

After you configure the remote site, write the Apex code that sends an HTTP request to the connected app to initiate the content sync. To allow the panel components to trigger the Apex methods, use the `@AuraEnabled` annotation for each method.

:::important
The endpoint must match the URL entered in the Remote Site URL field.
:::

This Apex sample includes methods for calls to Heroku and Marketing Cloud.

```java

public with sharing class CmsControlPanelController {
    @AuraEnabled
    public static String rebuildHeroku() {
        // Instantiate a new http object
        Http h = new Http();

        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://salesforcecms.herokuapp.com/build/');
        req.setMethod('POST');

        // Send the request, and return a response
        HttpResponse res = h.send(req);
        return res.getBody();
    }
    @AuraEnabled
    public static String refreshMarketingCloud() {
        // Instantiate a new http object
        Http h = new Http();

        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://salesforcecms.herokuapp.com/refreshMarketingCloud/');
        req.setMethod('POST');

        // Send the request, and return a response
        HttpResponse res = h.send(req);
        return res.getBody();
    }
}

```

**See Also**

- [Apex Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm)
- [*Apex Developer Guide*: AuraEnabled Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_AuraEnabled.htm)
