Manage API CALLS

In the code app you can create and edit API CALLS from a central place

1. Go to the Code Environment

On the right side click the app icon (1), then click Code Application (2)

codeapp

Or open the left main menu. 

Click Code, then click Overview.

codemenu

2. Open API Call Management

Click Manage.

apimanagement

3. API CALL Example

On the right sidebar, you can see an API CALL example.

More information on all parameters:

https://support.sitemanager.io/en/custom-integrations-with-api-call

functionexample-3

4. Activate

To manage and create api calls with shortcode or page properties click Activate

activate

5. Generate Code

Fill in the following properties:

generatecode-1

(1) API Label: a descriptive title for your API Call 

(2) API Type: "Default": to be used in the code editor. 

"Page Properties": Special API Call for page properties like title, meta tags, and open graph properties. More info here: https://support.sitemanager.io/en/api-call-page-properties

(3) Page: Select the pages for "Page Properties" (2)

(4) API Endpoint: link to your server file.

(5) CMS placeholder: code shown in the CMS where the API would be called on the live website

(6) API Call Type: POST or GET

The way the variables will be sent to your API endpoint URL.

PHP Example of POST.

$_POST["my_parameter"]

PHP Example of GET.

$_GET["my_parameter"]

(7) API Call Moment: call API on the "Live Website" or call API when the data is published in the CMS.

(8) Send SiteManager Parameters: extra POST or GET variables from the platform:

https://support.sitemanager.io/en/custom-integrations-with-api-call

PHP Example of POST variables.

echo $_POST["sm_lang_code"];
echo $_POST["sm_lang_folder"];
echo $_POST["sm_lang_id"];
echo $_POST["sm_page_id"];
echo $_POST["sm_project_name"];

PHP Example of GET variables.

echo $_GET["sm_lang_code"];
echo $_GET["sm_lang_folder"];
echo $_GET["sm_lang_id"];
echo $_GET["sm_page_id"];
echo $_GET["sm_project_name"];

(9) Cookies: save the cookies returned from the call in cookies from the current domain

(10) API headers: add header names with their values to the call

PHP Example of getting all the header 

foreach (getallheaders() as $name => $value) {
echo "header $name: $value <br>";
}

(11) URL parameters: add which parameters from the URL are being added to the call

(12) Generate API code: click this button when you are done 

 

6. Save API CALL

After the code is generated you can click "cancel" to return to the properties, or click 

"Save API CALL" to add it to the project

saveapi-3

The API Calls are shown in two lists: one for the default (in code) calls and one for the special (page property calls).

apilist

7. Edit API CALL (default)

Click the collapse icon on the right to open an API call.

editcall-1

You can change the Label and API CODE. You also see the API Short Code that is used 

for adding this code to component in the project.

https://support.sitemanager.io/en/api-call-shortcode

 

8. Edit API CALL (page properties)

Click the collapse icon on the right to open an API call.

editcall2-1

Besides changing the label and API Code, you can also select the page where the call will be made.

More information about this type of CALL can be found here:

https://support.sitemanager.io/en/api-call-page-properties