AlbaniaDreamin24 - How to easily use an API with Flows
ThierryTROUIN
78 views
50 slides
Apr 26, 2024
Slide 1 of 50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
About This Presentation
Albanian Dreamin a Community Powered Conference to activate, empower and strengthen the Salesforce potential through assistance, education, networking and knowledge sharing to improve the workforce and professionalism in Albania.
Size: 7.24 MB
Language: en
Added: Apr 26, 2024
Slides: 50 pages
Slide Content
How to easily use an API with Flows
Karine IOST Salesforce enthusiast since 2020 Salesforce Consultant at Accenture Fundation Admin certified Volunteer at French Touch Dreamin 2022 2023
Thierry TROUIN Salesforce Architect at Orange Business 13 years old on Salesforce ecosystem 10 Salesforce Certifications + 3 partners Certifications Group Leader at Toulouse Salesforce User Group Certified Instructor (Salesforce Administrator ) Salesforce MVP since 2021 French Touch Dreamin Co-Organiser Speaker on Salesforce Events x3 x2 x5
Agenda Definition Uses Case Tools and Features Setup Conclusion
Definition
Definition API = A pplication P rogramming I nterface API is a way for two or more programs or components to communicate with each other . It is a software interface , offering a service to other software . API Request Request Response Response Client / Application Base de données
Use Case
Use Case Some examples of API use Today ’s or week’s weather List of public holidays for the current year Automatically update an exchange rate L ist of city in an area Official bulletin of civil and commercial announcements
Use Case Our company has a needs : Retrieve the public holidays in France for the year 2024 .
Use Case How can I answer it ? Our company has a needs : Retrieve the public holidays in France for the year 2024 .
Use Case How can I answer it ? The site « https://api.gouv.fr » offers us a free API listing public holidays. Our company has a needs : Retrieve the public holidays in France for the year 2024 .
Tools & Features
Tools & Features Tools : https://swagger.io https://api.gouv.fr/documentation/jours-feries https://www.salesforce.com
Tools & Features Tool s : Salesforce Features : https://swagger.io https://api.gouv.fr/documentation/jours-feries https://www.salesforce.com Named Credentials Flows (screen) External Services Remote Site Settings
Setup
Setup - Identify our API Access the URL « https://api.gouv.fr/documentation/jours-feries » to view the API documentation I chose an API
Setup - Identify our API Access the URL « https://api.gouv.fr/documentation/jours-feries » to view the API documentation Here the API URL
Setup – Set connection Add the Url « https://calendrier.api.gouv.fr » into the list of « Remote Site Settings » List of authorized sites from Salesforce
Setup – Set connection Click the « New Legacy » button to set the API connection in Salesforce
Setup – Set connection Enter the « Name » and « URL » https://calendrier.api.gouv.fr that corresponds to the API
Setup – Load API Click the « Add an External Service » button to add the API schema.
Setup – Load API Select « From API Specification »
Setup – Load API Enter the information
I have an error about the format Setup – Load API Enter the information
Setup – Load API Enter the information The schema provided by the site (YAML) is not compatible with Salesforce (JSON) You must use a conversion tool (swagger)
Setup – Load API Let’s go to the swagger site « https://swagger.io/ »
Setup – Load API Click on the link to view the communication schema https://api.gouv.fr/documentation/jours-feries API Schema
Setup – Load API Click on the « File » menu Click on the « Import URL » menu Paste the API URL « https://calendrier.api.gouv.fr/jours-feries/openapi.yml »
Setup – Load API Click on the « File » menu Click on the « Convert and save as JSON » menu The file is automatically saved on our PC
Setup – Load API Select « Upload from local » Click on the « Upload Files » button
Setup – Load API Select « Upload from local » Click on the « Upload Files » button
Setup – Load API Select the operation (s)
Setup – Load API Click on the « Finish » button to save the « External Service » Summary of Operations in the external service
Setup – Load API Well done, you have configured your service.
Setup – Designing the Screen Flow In Setup Click on the « Flows » menu Click on the « New Flow » button Select « Screen Flow »
Setup – Designing the Screen Flow Step 1 : Add the Screen component Get the current year
Setup – Designing the Screen Flow Add the « Number » component to input the year Click on « Defaut Value » then click on « New Resource »
Setup – Designing the Screen Flow Creating a resource to get the current year by default Input the name « ThisYear » Select the data type « Number » without decimal Use the function TODAY() to retrieve the today’s date Use the function YEAR() retrieve only the year of our date YEAR( TODAY() )
Setup – Designing the Screen Flow The 1 st form is created
Setup – Designing the Screen Flow Step 2 : Add the « Action » component Retrieving public holidays
Setup – Designing the Screen Flow Add an action In menu, select « JourFeries » Click on « getZoneAndAnnee » Name of our External Service Created just before Public holiday ’s recovery function name
Setup – Designing the Screen Flow Input the action « Label » Select the « txtAnnee » corresponding to the text box of the 1 st form Create the « Zone » constante with « metropole » value
Setup – Designing the Screen Flow Step 3 : Add a « Screen » component The result screen
Setup – Designing the Screen Flow Add the « Display Text » component and name it « txtResultat » In the « Resource Picker » area Click on « Outputs from GetJoursFeries » Click on « 200 » ( which corresponds to our result ) Delete the point « . » at the end of the « {!GetJoursFeries.200} » variable
Setup – Designing the Screen Flow The 1 st screen shows the current year The 2 nd screen shows the result
Conclusion
Conclusion Steps Action Comments Step 1 Identify our API https://api.gouv.fr/documentation/jours-feries Step 2 Set connection into Salesforce Remote site + Named Credential Step 3 Load API into Salesforce External Services (+ swagger) Step 4 Designing the Screen Flow Flow