Available in Classic and VPC
This guide covers the usage scenarios for API Workflow.
Step 1. Generating API Authentication Keys
To create a workflow using NAVER Cloud Platform APIs, you must complete NCP Signature authentication. NCP Signature authentication requires the Access Key ID and Secret Key information of the API authentication key. To create an API Authentication key, follow the steps below:
- Log in to the NAVER Cloud Platform console.
- Go to My Account > Manage Account and Security in the upper-right corner of the console.
- Enter your password and click the [OK] button.
- Go to Security Management > Access Management.
- Click the [Create New Authentication Key] button.
- If you have already generated an authentication key, use it
- Check the Access Key ID and Secret Key of the generated API authentication key.
- API authentication keys are only generated when using NAVER Cloud Platform APIs.
- For more information on how to generate API authentication keys, see Generating API Authentication Keys.
- For more information on how to register an NCP Signature, see Registering NCP Signatures.
Step 2. Register API
You can register a new API by registering the API's name, method, URL, and request parameters. For NAVER Cloud Platform APIs, selecting NCP Signature as the authentication method automatically generates an authentication signature through the Access Key and Secret Key registered in API Workflow. To register the available region list lookup API, follow the steps below.
- From the NAVER Cloud Platform console, click
> Services > Management & Governance > API Workflow menu in order. - In the API Template menu, click [Register API Template].
- Enter ‘Check Billing Costs’ as the name of the API you want to register.
- Select Method and enter the URL.
- Method: Select ‘GET’
- URL: Enter 'https://billingapi.apigw.ntruss.com/billing/v1/cost/getDemandCostList'
- Add 'Cost' as a Tag.
- Select NCP Signature as the Authority.
- If you don't have an authentication signature, the NCP Signature registration window appears. Enter the API authentication key information from Step 1.
- In the Request field, enter the parameters for the API you want to call and click [Add].
Key Description Type Default value Required startMonth Lookup Start Month (yyyymm) Query 202204 endMonth Lookup End Month (yyyymm) Query 202204 responseFormatType response type ( json / xml) Query json NoteSet the response type to JSON. API Workflow only supports internal navigation for responses in JSON format by default. Start/End months can be set arbitrarily.
- Click the [TEST] button in the URL field and verify that the value is imported correctly.
- Click [Save].
For more information on how to register an API, see Registering and Managing API Templates.
Step 3. Create a workflow
Create a workflow using the APIs registered in API Template. You can also create a workflow that is a combination of multiple workflows.
To create a workflow using a registered API, follow the steps below.
- From the NAVER Cloud Platform console, click
> Services > Management & Governance > API Workflow > Workflow menu in order. - Click the [Create Workflow] button.
- Enter a name for the workflow you want to create.
- On the Workflows tab, click [+] > API in the workflow chart.
- Click the [Load] button in API Template, then select the 'Check Billing Costs' API from the list of API Templates and click the [OK] button.
- Under API Entity, click [+] > Set Properties.
- Properties are variables that can store specific values needed to run a Workflow.
- On the [Property] tab, click [+Add] to create a Integer-type "totalRow" to store the number of billing receipt lists.
- Enter the property information and click the [Add] button.
- Property: ${totalRow}
- Entity: API-1, response, body
- Key: getDemandCostListResponse.totalRows
NoteStore the getDemandCostListResponse.totalRows value from the API-1 Entity's Response field in the Body in the totalRow property. For the JSON body only, you can access internal objects in the form of key1.key2.
- Under the Entity you created above, click [+] > if and add an IF condition.
- Operand 1st: ${totalRow}
- Comparison: >(Greater than)
- Operand 2nd: Direct Input, 0
NoteThis is a condition that allows you to check if the totalRow of the value received in response from an API-1 Entity is greater than 0.
- Click [+] > SetProperties under IF Entity.Note
When SetProperties is placed under an IF, it means that sub-entities will only run when the IF condition is true.
- On the [Property] tab, click [+Add] to add a Integer-type useAmount and a String-type requestId.
- useAmount: Save Amount Billed
- requestId: Save the request ID
- Enter your property information.
Property Entity Key useAmount API-1, response, body getDemandCostListResponse.demandCostList.useAmount requestId API-1, response, body etDemandCostListResponse.requestId - After clicking Finish Entity, enter the following for Body
{ "useAmount" : ${useAmount}, "requestId": "${requestId}" }Note- The header and body you set for the Finish Entity are used to store the final output value. When you call an endpoint in your workflow, it returns the header and body of the corresponding Finish Entity.
- Entering the value of a property as a ${propertyKey}, replaces it with the value of the property.
- To verify that the workflow you configured is working properly, click the [Run Test] button.
- Make sure that Finish includes the amount billed and the requestId information.
- If an error occurs, you can click on the entity to see a detailed error message.
- Click the [Create Workflow] button.
For a more information on how to create a workflow, see Creating and Managing Workflows.
Step 4. Scheduling
Automatically runs configured workflows according to a designated cycle. To set up a workflow to run every day at 10:30 am, follow the steps below.
- From the NAVER Cloud Platform console, click
> Services > Management & Governance > API Workflow > Workflow menu in order. - Select a workflow, then click the [Schedule] button.
- When the Schedule settings window appears, set the start and end periods.
- Enter '0 30 10 * * ?’ in the In the Cron expression input field .
- Enter your request information.
- Click the [Apply] button.
For a more information on Schedules, see Setting Up an Autorun Schedule.