> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API Developer Portal

> Provides installation and configuration of Apinizer API Developer Portal on Kubernetes. Provides portal installation steps where API consumers can access documentation related to APIs, test them and use them. Contains integration details with API Manager.

## Introduction

API Developer Portal is an end-user or developer portal where API Consumers can access documentation related to APIs offered by an organization, test them, use them within certain limitations, and ask and answer questions about these topics.

API Developer Portal, like other Apinizer products, runs on Kubernetes Platform. No database is used for Portal operations, instead interaction is provided directly with APIs provided by API Manager.

## Pre-Installation Steps

Before starting the installation of Apinizer API Portal, the following should be noted:

<CardGroup cols={2}>
  <Card title="Apinizer Installation" icon="server" href="/en/setup/apinizer/apinizer">
    Learn API Manager installation
  </Card>
</CardGroup>

<Warning>
  API Manager must be installed. Also, API Developer Portal must be present in your license key.
</Warning>

## Installation Steps

API Portal Installation is done in two ways.

* If Kubernetes management is done **through** Apinizer, you can install API Developer Portal through API Manager.
* If Kubernetes management is **not** done through Apinizer, manual installation can be done to Kubernetes and then connection can be established with API Manager.

### Creating Token for Personal API Access

Token information can be obtained by creating a new token or using an existing token on the My Profile page. Staff tokens usually start with the `apnz_` prefix.

<Info>
  To create a token, you can go to the My Profile page in API Manager and create a new token.
</Info>

<Frame caption="Token creation - Creating personal API token from My Profile page">
  <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/api-portal/01-token-olusturma.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=c44abc15a0c090f2970ef92462fb82c2" alt="Token Creation" width="1200" height="800" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/api-portal/01-token-olusturma.png" />
</Frame>

### API Developer Portal Installation

#### If API Developer Portal Installation Will Be Done Through API Manager

For API Developer Portal installation through API Manager, the following section must be active in the General Settings menu.

<Warning>
  If Kubernetes management is done through Apinizer, the "Kubernetes Management" option must be active on the General Settings page.
</Warning>

In API Manager, go to **Administration → Server Management → Kubernetes Resources** page. Enable API Portal from the Deployment & Pods tab. Complete the installation by making the necessary definitions.

<Frame caption="Kubernetes Resources page - API Portal enablement">
  <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/api-portal/02-kubernetes-resources.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=2acc8694b19b9902c0d60fa4082b6e72" alt="Kubernetes Resources Page" width="1200" height="600" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/api-portal/02-kubernetes-resources.png" />
</Frame>

In the opened dialog, define the required fields according to your organization.

<Frame caption="API Portal installation dialog - Configuration of required settings">
  <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/api-portal/03-api-portal-dialog.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=3521f7755c5c7e7a26a3f37966f84f50" alt="API Portal Installation Dialog" width="1200" height="800" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/api-portal/03-api-portal-dialog.png" />
</Frame>

<Frame caption="API Portal settings - API Manager integration configuration">
  <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/api-portal/04-api-portal-ayarlari.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=0e082de3b2b8e60e6af3382c66cad92d" alt="API Portal Settings" width="1200" height="800" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/api-portal/04-api-portal-ayarlari.png" />
</Frame>

| Field                                             | Description                                                                                                                                                                                                                                              |
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Apinizer Portal Management API URL**            | Management API address run by API Manager required for API Developer Portal to consume Apinizer Management APIs. Example address: `http://<API_MANAGER_ACCESS_URL>:<PORT>/`                                                                              |
| **Apinizer Portal Management API Key/Token**      | Token information required for API Developer Portal to consume Apinizer Management APIs.                                                                                                                                                                 |
| **Count** *(Count)*                               | Gateway engine count, adjusts the replicaSet setting in Kubernetes Cluster.                                                                                                                                                                              |
| **Service Port** *(Service Port)*                 | Gateway engine access port, adjusts the NodePort setting of the service object in Kubernetes Cluster.                                                                                                                                                    |
| **Node List** *(Node List)*                       | Sets which Kubernetes Worker servers the Pods will run on. Adjusts the NodeAffinity setting in Kubernetes.                                                                                                                                               |
| **CPU**                                           | Information about the maximum CPU core count the Pod will use.                                                                                                                                                                                           |
| **Memory** *(Memory)*                             | Maximum memory value the Pod will use.                                                                                                                                                                                                                   |
| **Memory Unit** *(Memory Unit)*                   | The unit of the value required for memory is selected; MB, GB.                                                                                                                                                                                           |
| **Additional Variables** *(Additional Variables)* | Default and optional variables and values to be run in the Pod are defined. Default variables cannot be deleted, only their values can be edited.                                                                                                        |
| **Host Aliases** *(Host Aliases)*                 | IP addresses in the network can sometimes be placed behind host names, if these are not defined in nameserver or host file or cannot be resolved by Apinizer in some way, **Host Alias** definition must be made for worker pods to resolve these names. |

<Info>
  **Additional Variables**

  When configuring the **Java Options** setting in the Additional Variables field, the following warning should be considered:

  * When **-Xmx** and **-Xms** parameters are used, automatic heap sizing is disabled.
  * Apinizer sets **JVM Heap** values to use **75.0%** of the memory given to the container since it runs inside the container.
  * **UseContainerSupport** is active by default.
  * Old flags `-XX: {Min | Max} RAMFraction` are now deprecated. There is a new `-XX: MaxRAMPercentage` flag that takes a value between 0.0 and 100.0 and defaults to 75.0. Therefore, if there is a 1 GB memory limit, the JVM heap is limited to \~ 750 MB by default.
</Info>

#### If API Developer Portal Installation Will Not Be Done Through API Manager

The following steps should be followed for manual installation of API Developer Portal.

<Warning>
  **Important:** Kubernetes **Secret** containing API Manager API address and API Key/Token information must be created. The following information should be filled according to your organization.
</Warning>

* **apinizerManagementApiBaseUrl**: Management API address running on API Manager required for API Developer Portal to consume Apinizer Management APIs. An example address: `http://apimanager-ui-ip-address:port`
* **apiKey**: Token information required for API Developer Portal to consume Apinizer Management APIs.

```bash theme={null}
API_MANAGER_URL='<APINIZER_MANAGEMENT_API_BASE_URL>'
API_MANAGER_APIKEY='<API_KEY>'
echo -n ${API_MANAGER_URL} | base64  # We will put the output of this in place of <ENCODED_URL> variable in the next step
echo -n ${API_MANAGER_APIKEY} | base64  # We will put the output of this in place of <ENCODED_API_KEY> variable in the next step
vi api-portal-secret.yaml
```

```yaml theme={null}
apiVersion: v1
kind: Namespace
metadata:
  name: apinizer-portal
---
apiVersion: v1
kind: Secret
metadata:
  name: apinizer-portal-secret
  namespace: apinizer-portal
type: Opaque
data:
  apinizerManagementApiBaseUrl: <ENCODED_URL>
  apiKey: <ENCODED_API_KEY>
```

```bash theme={null}
kubectl apply -f api-portal-secret.yaml
```

```bash theme={null}
vi apinizer-portal-deployment.yaml
```

```yaml theme={null}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: apinizer-portal
  namespace: apinizer-portal
spec:
  replicas: 1
  selector:
    matchLabels:
      app: apinizer-portal
      version: v1
  template:
    metadata:
      labels:
        app: apinizer-portal
        version: v1
    spec:
      containers:
        - name: apinizer-portal-app
          image: apinizercloud/apiportal:<APINIZER_VERSION>
          env:
            - name: SPRING_PROFILES_ACTIVE
              value: prod
            - name: JAVA_OPTS
              value: -XX:MaxRAMPercentage=75.0
            - name: API_PORTAL_MANAGEMENT_API_BASE_URL
              valueFrom:
                secretKeyRef:
                  key: apinizerManagementApiBaseUrl
                  name: apinizer-portal-secret
            - name: API_PORTAL_MANAGEMENT_API_KEY
              valueFrom:
                secretKeyRef:
                  key: apiKey
                  name: apinizer-portal-secret
          livenessProbe:
            failureThreshold: 13
            httpGet:
              path: /apinizer/management/health
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 30
          ports:
            - containerPort: 8080
              protocol: TCP
          readinessProbe:
            failureThreshold: 13
            httpGet:
              path: /apinizer/management/health
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 30
          resources:
            limits:
              cpu: "1"
              memory: 1Gi
          startupProbe:
            failureThreshold: 13
            httpGet:
              path: /apinizer/management/health
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: apinizer-portal-service
  namespace: apinizer-portal
  labels:
    app: apinizer-portal
spec:
  selector:
    app: apinizer-portal
  type: NodePort
  ports:
    - name: http
      port: 8080
      nodePort: <API_DEVELOPER_PORTAL_PORT>
```

```bash theme={null}
kubectl apply -f apinizer-portal-deployment.yaml
```

<Warning>
  **Important**

  Up to this stage, API Developer Portal interface installation may have been done, but for APIs to be displayed on API Developer Portal, Credentials to be created and other capabilities to be used, integration with API Manager must be done.
</Warning>

### API Developer Portal Integration with API Manager

In API Manager, go to **Portal → Settings → Portal** page and make the definitions according to your organization.

[Click here for detailed information](/en/api-portal/api-portal-settings).

### Starting API Developer Portal with SSL

In desired cases, API Developer Portal can be opened for access with SSL.

[Click here for detailed information](/en/operations/administrator-guides/api-developer-portal-ssl).

After completing the above steps and ensuring that the Pods belonging to API Portal on Kubernetes are in ready state, you can access the Portal Interface from the following address.

```
http://<KUBERNETES_WORKER_IP>:<API_PORTAL_PORT>
```

## Next Steps

<CardGroup cols={2}>
  <Card title="API Portal Overview" icon="window-maximize" href="/en/api-portal/overview">
    Get detailed information about API Portal
  </Card>

  <Card title="API Integration Installation" icon="plug" href="/en/setup/apinizer/api-integration">
    Learn API Integration installation
  </Card>

  <Card title="Multi-Region Installation" icon="globe" href="/en/setup/apinizer/multi-region">
    Learn Multi-Region installation
  </Card>

  <Card title="Apinizer Installation" icon="server" href="/en/setup/apinizer/apinizer">
    Learn Apinizer installation
  </Card>
</CardGroup>
