After you have created a Publish API in Flowfactory this guide will show you how to access the API from an external application. You can also use this guide to test your API during development.
This guide is based on the Product API. To create this API you can follow our guide here.
1. Activate API
To activate your Published API in Test mode, start a new test session from Flowfactory Studio.
Your endpoint URL is the same as your applications URL so simply copy this part of the URL from your test session.
http://679d8d80-b6f4-4d11-8df4-9d16eb926f93.test.studiodev.app.flowfactory.com/
2. Configure Postman to call your Flowfactory Application
We will use the software Postman to access our API. If you haven’t already you can download it at https://www.postman.com/downloads/
Copy your application URL and add /Auth/LoginAPI to the URL like this (your URL will be different from the example in this guide):
http://679d8d80-b6f4-4d11-8df4-9d16eb926f93.test.studiodev.app.flowfactory.com/Auth/LoginAPI
This is the static Flowfactory Authentication Endpoint. Now you can just paste this URL into a new POST request in Postman like below:
2. Setup parameters to Authenticate user
To request a security access token from the Flowfactory application we need to provide a user that has access to your application. Either you create a new API User and add it to your Flowfactory Application or you can use an existing user.
Set two new parameters in Postman like described below:
3. Request a security token
Now we have configured the request in Postman and you can click SEND to send the request to your applications. If everything goes well and your user is Authenticated you will receive a response containing the AccessToken
Use authentication token in request
We are now Authenticated and can use this token to access Flowfactory APIs. So next step is to call the Flowfactory API and create a new Product.
1. Setup call to Flowfactory Application
Start by creating a new POST Request in Postman. Paste the URL to your application like we did with the Authentication request.
http://679d8d80-b6f4-4d11-8df4-9d16eb926f93.test.studiodev.app.flowfactory.com/
Then add the prefix for the Published API. In the case of the Product API this is
http://679d8d80-b6f4-4d11-8df4-9d16eb926f93.test.studiodev.app.flowfactory.com/externalapi/v1/products/product
We then set our parameters as a JSON-body for the request. Your data here should match the Property names of your Entity
2. Add authorization token
Last we need to add the Authorization token the API. This can be done by selecting the Authorization tab in the Postman request. Then select Type = Bearer Token and simply copy the Access Token from your Authentication call and paste this in the Token field. This will automatically add the token to the header in the request.
We are now good to go and you can click Send and your new product is added to your Flowfactory Application.
Comments
0 comments
Please sign in to leave a comment.