You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/features/sql-big-data-cluster/app-deploy/addpy/README.md
+52-1Lines changed: 52 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,58 @@ To run this sample, you need the following prerequisites.
73
73
"success": true
74
74
}
75
75
```
76
-
6. You can clean up the sample by running the following commands:
76
+
6. Any app you create is also accessible using a RESTful web service that is [Swagger](swagger.io) compliant. You can get the endpoint for the web service by running:
Note the IP address and the port number in this output. Open the following URL in your browser:
109
+
`https://[IP]:[PORT]/api/docs/swagger.json`. You will have to log in with the same credentials you used for`mssqlctl login`. The contents of the `swagger.json` you can paste into [Swagger Editor](https://editor.swagger.io) to understand what methods are available:
110
+

111
+
112
+
Notice the `app` GET method as well as the `token` POST method. Since the authentication forapps uses JWT tokens you will need to get a token my using your favorite tool to make a POST call to the `token` method. Here is an example of how to do just thatin [Postman](https://www.getpostman.com/):
113
+

114
+
115
+
The result of this request will give you an `access_token`, which you will need to call the URL to run the app.
116
+
117
+
>*Optional*: If you want, you can open the URL forthe `swagger` that was returned when you ran `mssqlctl app describe --name addpy --version [version]`in your browser. You will have to log in with the same credentials you used for`mssqlctl login`. The contents of the `swagger.json` you can paste into [Swagger Editor](https://editor.swagger.io). You will see that the web service exposes the `run` method.
118
+
119
+
You can use your favorite tool to call the `run` method (`https://[IP]:[PORT]/api/app/addpy/[version]/run`), passing in the parameters in the body of your POST request as json. In this example we will use [Postman](https://www.getpostman.com/). Before making the call, you will need to set the `Authorization` to `Bearer Token` and paste in the token you retrieved earlier. This will set a header on your request. See the screenshot below.
120
+

121
+
Next, in the requests body, pass in the parameters to the app you are calling and set the `content-type` to `application/json`:
122
+

123
+
When you send the request, you will get the same output as you did when you ran the app through `mssqlctl app run`:
124
+

125
+
You have now successfully called the app through the web service!
126
+
127
+
7. You can clean up the sample by running the following commands:
0 commit comments