Skip to content

Commit

Permalink
Merge pull request #1698 from dinusha92/release_branch
Browse files Browse the repository at this point in the history
Release branch
  • Loading branch information
dinusha92 authored Mar 8, 2021
2 parents cadc238 + 0677bec commit 61d7733
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ export PATH=$PATH:<CLI_HOME>

3. Let's create our first project with name "petstore" by adding the [open API definition](https://petstore.swagger.io/v2/swagger.json) of the petstore . You can do that by executing the following command using your command line tool.

NOTE: If you have used a previous version of apictl before, remember to delete the directories
.wso2apictl and .wso2apictl.local that are located in `/home/<your-pc-username>`. Deleting them will make the newer apictl create them again, with content compatible with the current version. You can backup the files before deleting them, in case you had to refer them later.
!!! NOTE:

If you have used a previous version of apictl before, remember to delete the directories .wso2apictl and .wso2apictl.local that are located in `/home/<your-pc-username>`. Deleting them will make the newer apictl create them again, with content compatible with the current version. You can backup the files before deleting them, in case you had to refer them later.

```
apictl init petstore --oas https://petstore.swagger.io/v2/swagger.json
Expand All @@ -65,7 +66,13 @@ Once containers are up and running, we can monitor the status of the containers
docker ps | grep mg-
```
The user credentials can be configured in the configurations of the `MG_HOME` distribution. `admin:admin` is the default accepted credentials by the
microgateway adapter..
microgateway adapter.

!!! NOTE:

Following apictl commands are being executed with -k flag to avoid SSL verification with the microgateway.

To communicate via https without skipping SSL verification (without -k flag), add the cert of Microgateway into `/home/<your-pc-username>/.wso2apictl/certs` .

6. To use apictl with Microgateway, let's first add a environment specifically for our microgateway. The environment will hold the adapter URL for further commands.

Expand All @@ -76,27 +83,26 @@ apictl mg add env dev --adapter https://localhost:9843
7. Next you can use the following command to login to the above microgateway cluster (in other words login to the microgateway adapter).

```
apictl mg login dev
apictl mg login dev -k
```
or
```
apictl mg login dev -u admin -p admin
apictl mg login dev -u admin -p admin -k
```

NOTE: Remember to add the cert of Microgateway into `/home/<your-pc-username>/.wso2apictl/certs` to communicate via https (to avoid having to use insecure mode with -k or --insecure).

8. Now let's deploy our first API to Microgateway using the project created in the step 3. Navigate to the location where the petstore project was initialized. Execute the following command to deploy the API in the microgateway.

```
apictl mg deploy api -f petstore -e dev
apictl mg deploy api -f petstore -e dev -k
```

9. The next step would be to invoke the API using a REST tool. Since APIs on the Microgateway are by default secured. We need a valid token in order to invoke the API.
Use the following sample token accepted by the microgateway to access the API. Lets set the token to command line as a variable


```
TOKEN=eyJ4NXQiOiJNell4TW1Ga09HWXdNV0kwWldObU5EY3hOR1l3WW1NNFpUQTNNV0kyTkRBelpHUXpOR00wWkdSbE5qSmtPREZrWkRSaU9URmtNV0ZoTXpVMlpHVmxOZyIsImtpZCI6Ik16WXhNbUZrT0dZd01XSTBaV05tTkRjeE5HWXdZbU00WlRBM01XSTJOREF6WkdRek5HTTBaR1JsTmpKa09ERmtaRFJpT1RGa01XRmhNelUyWkdWbE5nX1JTMjU2IiwiYWxnIjoiUlMyNTYifQ==.eyJhdWQiOiJBT2syNFF6WndRXzYyb2QyNDdXQnVtd0VFZndhIiwic3ViIjoiYWRtaW5AY2FyYm9uLnN1cGVyIiwibmJmIjoxNTk2MDA5NTU2LCJhenAiOiJBT2syNFF6WndRXzYyb2QyNDdXQnVtd0VFZndhIiwic2NvcGUiOiJhbV9hcHBsaWNhdGlvbl9zY29wZSBkZWZhdWx0IiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6OTQ0My9vYXV0aDIvdG9rZW4iLCJrZXl0eXBlIjoiUFJPRFVDVElPTiIsImV4cCI6MTYyNzU0NTU1NiwiaWF0IjoxNTk2MDA5NTU2LCJqdGkiOiIyN2ZkMWY4Ny01ZTI1LTQ1NjktYTJkYi04MDA3MTFlZTJjZWMifQ==.otDREOsUUmXuSbIVII7FR59HAWqtXh6WWCSX6NDylVIFfED3GbLkopo6rwCh2EX6yiP-vGTqX8sB9Zfn784cIfD3jz2hCZqOqNzSUrzamZrWui4hlYC6qt4YviMbR9LNtxxu7uQD7QMbpZQiJ5owslaASWQv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45j1uOx0JnjvRDtiKt01GtwG0idGKwA9xVOuMKYzKochFy9TwA1HVNC7edNJ-gcw5ceoj4Is6r-KM0qGQLMAc8OrkyaAgU1ForFJAXVzl1IguXgLuux6uJzkmCJlC4bhrA
```

10. We can now invoke the API running on the microgateway using cURL as below.
Expand Down

0 comments on commit 61d7733

Please sign in to comment.