Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENDOC-494 update core api tutorial #532

Merged
merged 5 commits into from
Jul 10, 2022
Merged

ENDOC-494 update core api tutorial #532

merged 5 commits into from
Jul 10, 2022

Conversation

jyunmitch
Copy link
Collaborator

No description provided.

@jyunmitch jyunmitch requested review from nshaw and Lyd1aCla1r3 July 6, 2022 16:17
Entando supports Swagger and it is accessible, if activated, from its
web interface from the base application URL at /api/swagger-ui.html. A
complete list of all available core APIs can be obtained from Swagger.
Entando Core APIs can be called directly with Swagger or tools like curl and Postman. Entando uses Swagger to automatically generate OpenAPI documentation that allow such interactions. This tutorial describes how to set up an environment ready to invoke the APIs using Postman.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify per today's meeting notes.

(Refer to [User Management Roles](../../docs/consume/identity-management.md#authorization) for details)
* Basic knowledge of Postman. You can download the Postman Application or use Postman on the web. If you are using the latter, you will need to change the Keycloak configuration.
* A running Entando instance
* A running Jhipster application
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the Core APIs tutorial, this requires a local running copy of the Entando App Engine. See https://github.com/entando/entando-de-app

I couldn't resist trying this live (enable the Swagger UI in an existing entando-de-app deployment. For Wildfly, add _JAVA_OPTION=-Dspring.profiles.active=swagger.) but it didn't work...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JHipster isn't required for the core APIs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watched Anthony on the Oauth2 set up and got confused

localhost:8080/entando-de-app/api/pages), or the Page Template Controller
will available under /pageModels (i.e.
localhost:8080/entando-de-app/api/pageModels) and so on.
To perform extensive testing with APIs on Postman, set up an environment and define a variable to host the access token saved with a POST request to /oauth/token. This should provide access to all API endpoints and actions for the user's defined privileges.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"set up an environment" seems a like a given and is a bit awkward to include, especially in such a long sentence that's packed with details. "...Postman, define an environment variable to host the access token saved by issuing a POST request..."
i'd change "with" to "by issuing" because "saved with" reads like something else is saved along with the access token

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"for the user's defined privileges" is a little wordy and stands out because it's like intentionally avoiding a reference to authorization
"this should provide access to all API endpoints and actions for which the user is authorized" or something similar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating an environment is a literal thing in Postman. You create and send Post requests, and the saving process is done through the variable so it can't be saved by just issuing a post request.


(Refer to [User Management Roles](../../docs/consume/identity-management.md#authorization) for details)
* Basic knowledge of Postman. You can download the Postman Application or use Postman on the web. If you are using the latter, you will need to change the Keycloak configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is "Application" capitalized?

"using the latter" references "use Postman" which one too many "uses." can simplify to "the latter requires changes to the Keycloak configuration"?

## Requirements
* `Auth` section
1. `Type` → Basic Auth\
2. Enter `Username` and `password`. Valid Entando credentials are required. It will be the same as used in the App Builder.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they will be the same

for the App Builder - credentials are used to access the App Builder, not to access anything within it

2. Enter `Username` and `password`. Valid Entando credentials are required. It will be the same as used in the App Builder.

* `Headers` section \
Create a new `KEY`: `VALUE` pair as shown: \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrt the pair, either add space before : or remove space after :

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that bothered me so I looked it up, it's used as key-value pair. But here it is written in all caps in Postman so kept it.


Create a new Postman environment and define the following variables:
>If you go to edit the Postman environment you created, you should see that the access_token and the refresh_token variables values have been updated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable values

### 2. Get an access token
* `Headers` section:
* Create the key Authorization with Value: Bearer
* Create the key Content-Type with Value: application/json`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one backtick??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is "Value" capitalized? and why are colons needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redid this section. there's column key & column value.
under KEY you enter "Authorization" and for that, under VALUE you enter Bearer<< KEY-VALUE pair. So you create both key and value

* Create the key Authorization with Value: Bearer
* Create the key Content-Type with Value: application/json`

2. Select the appropriate method (GET, DELETE, POST etc.) for your request and enter the URL with appropriate values, (i.e. localhost:8080/entando-de-app/api/pages).
Copy link
Contributor

@Lyd1aCla1r3 Lyd1aCla1r3 Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POST, etc.

"desired URL"... "URL with appropriate values" is very odd phrasing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as was, i think because it could be anything IRL


Getting an access token is a prerequisite to be able to invoke any API.
The following is the required activity.
* For more information on testing, the [Collection Runner on Postman](https://learning.postman.com/docs/running-collections/intro-to-collection-runs/) enables you to run the API requests in a collection in a specified sequence.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sentence seems incongruous. i'm expecting a link to documentation/resources that discuss testing, not the link to a specific use case. why not "see the Collection Runner on Postman to run the API requests in a collection in a specified sequence"??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The collection runner is a test or a way to run a collection of tests. I think devs would know what is meant here. Running the API request collection in a certain order is like a full batch test of different circumstances I think.

@@ -15,7 +15,7 @@ To perform extensive testing with APIs on Postman, set up an environment and def
## Prerequisites

* Basic knowledge of Postman. You can download the Postman application or use Postman on the web. The latter requires changes to the Keycloak configuration.
* A local running copy of the Entando App Engine. For more details, refer to the [Entando App Engine Repository Readme](https://github.com/entando/entando-de-app/blob/develop/README.md#using-swagger)
* A local running copy of the Entando App Engine. For more details, refer to the [Entando App Engine GitHub Readme](https://github.com/entando/entando-de-app/blob/develop/README.md#using-swagger)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add period?

@Lyd1aCla1r3 Lyd1aCla1r3 self-requested a review July 8, 2022 19:17
@nshaw
Copy link
Contributor

nshaw commented Jul 8, 2022

@Lyd1aCla1r3 I think we still need this added to /next. Would you be able to handle that?

@nshaw nshaw merged commit 8ac47ab into main Jul 10, 2022
@nshaw nshaw deleted the ENDOC-494 branch July 10, 2022 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants