Export data using an API request

Prerequisites

Before you start configuring an API request, ensure you have the following tools and solutions:

  • Notepad v8.5 and higher.

Step 1: Setting a relationship between the Data entities

When working with multiple entities with different structures, establish relationships between the entities and their corresponding fields, ensuring the fields are equivalent.

  1. In the Finance and Operations, expand the Modules and select Outbridge.
  2. From the displayed menu, select Data integration > Composite entities.
  3. On the displayed page under the Data entities, select New.
  4. Add the necessary entities.
  5. Under the Relation, select New to add the necessary entities.
  6. In the Field name for each of the entities, specify the necessary fields. Note that the field names must be equal.
  7. Select Publish.
webrqt_composite_entity.jpg

Step 2: Creating a Data processor with a “API request” format type

  1. In the Finance and Operations, expand the Modules and select Outbridge.
  2. From the displayed menu, select Data integration > Data processors.
  3. On the displayed page, select New from the toolset panel at the top of the page.
  4. In the Data processor, provide the name or identification number of a new data processor.
  5. From the Format type, choose API requests.
  6. From the Class processor, choose API request processor.
  7. Select Save.
api_data_processor.jpg

Step 3: Creating a Storage connection with an “API request” format type

  1. In the Finance and Operations, expand the Modules and select Outbridge.
  2. From the displayed menu, select Data integration > Storage connections.
  3. Select New from the toolset panel at the top of the page.
  4. In the Storage ID, specify the name for your storage.
  5. From the Storage type, choose Web.
  6. In the Description, provide the details about the storage.
  7. Select Save.
webrqt_data_storage.jpg

Step 4: Creating an API request

  1. In the Finance and Operations, expand the Modules and select Outbridge.
  2. From the displayed menu, select Data integration > API requests > API collections.
  3. On the displayed page, select New > New collection from the toolset panel at the top of the page.
  4. On the displayed page, specify the name and description for the new API collection.
  5. Select Save.
  6. The following default Python variables are displayed:
    • request—a message sent from the Outbridge solution to a third-party server, asking it to perform an action or provide data. Python type: dictionaries (dict).
    • response—the message a server sends back to the Outbridge solution after processing the request. It typically includes a status code and any requested data or error details. Python type: dictionaries (dict).
    • repeat—retrying a request for additional data processing. Python type: booleans (bool).
    • port_data—the data of an incoming package from a Data port. Python type: text.
  7. If you want to create additional variables, select Add.

You can create the following types of variables and constants: simple variables, hidden variables, constants, and hidden constants. Use the alphabetic symbols without spaces to name the variables and constants. Values of the hidden variables and constants will not be visible.

  1. Provide a value for the new variable or constant.
  2. Select Save.
api_request_group.jpg

Step 5: Configuring an API request

  1. Inside the newly created API collection, select New > New request from the toolset panel at the top of the page.
  2. On the displayed page, provide the name and description for the new request.
  3. From the Request info, choose the appropriate type of request. The following types are available:
  • GET—retrieves data from the server without modifying it.
  • POST—sends data to the server to create a new resource.
  • PUT—replaces an existing resource with new data.
  • PATCH—partially updates an existing resource with the provided data.
  • DELETE—removes a specified resource from the server.
  • HEAD—similar to GET, but it only retrieves the headers (not the body) of a resource.
  • OPTIONS—returns the HTTP methods and options supported by a server or resource.
  1. Specify the name of your variable or constant that contains a link to the external server in the following format: _{name of variable or constant}/apiv2_.
  2. In the Request details section, select the Headers tab and then select Add.
  3. Specify the details for the Key, Value, and Description parameters of the request’s header. It is also available to use constants and variables as the header values.
  4. (Optional) Select the Body tab. Here, you can specify the information for the body of your request. The supported formats of a request are: Text, JSON, XML, and HTTP.
  5. (Optional) Specify the variable or constant following the syntax rules of the selected request format.
  6. (Optional) Select the Script tab. There are two types of events: those that occur before a request is sent and those that occur after a response is received.
  7. (Optional) Choose a necessary event type.
  8. Specify the script with Outbridge’s built-in Python engine, using the variables set in the API collection. You can also create and use local variables directly within the script.
  9. Select Save.

On the API request page, you can use the following options to reorder and format the request hierarchy inside the group:

  • Move up—shifts the selected request or a group one position higher in the list, maintaining the same level of hierarchy.
  • Move down—shifts the selected request or a group one position lower in the list at the same hierarchy level.

Step 6: Creating a Data project

  1. In the Finance and Operations, expand the Workspaces and select Data Management.
  2. On the displayed page, select Export.
data_management_export.jpg
  1. In the Group name, specify the title for your group.
  2. In the Description, provide details for the data project.
  3. Under the Selected entities, select Add file.
  4. From the Source data format, choose the file format for import.
  5. From the Entity name, choose the appropriate entity type.
  6. Select Upload and Add, and then insert the file containing the data from your local storage.
  7. After the file is successfully uploaded, select View map > Mapping details.
  8. Compare the mapping of the source and staging fields structure.
  9. If the mapping fails, select Entity attributes to verify the order of columns and other file structure elements.
  10. Select Save to finish the data project creation.

Step 7: Configuring a Data port

  1. In the Finance and Operations, expand the Modules and select Outbridge.
  2. From the displayed menu, select Data integration > Data ports > Data ports.
  3. On the displayed page, select New from the toolset panel at the top of the page.
  4. In the Port ID, provide the name or identification number of a new data port.
  5. In the Description, provide details about the new data port.
  6. From the Storage ID, choose the Web storage. 
  7. From the Data direction, choose Output.
  8. From the Data processor, choose the API request data processor you created earlier.
  9. From the API sequence, choose the sequence that should run.
  10. From the Data project, choose the appropriate project for the API request.
webrqt_data_port.jpg
  1. Select Format mapping > New.
  2. From the Entity, choose the data project set for the API request.
  3. Next, you need to generate a JSON script for entity mapping. Open a new window in your browser and specify the data/the name of the data project in the address bar. Your address bar can look like the following: _[https://www.sandbox.operations.dynamics.com/data/CustomerGroups]()_
  4. Press the Enter key on your keyboard and wait until the file is done.
  5. Copy the contents of the generated JSON script into Notepad.
  6. Save the Notepad file.
  7. Return to the Data Port page and select Import template.
  8. Upload your Notepad file with the JSON script.
  9. Select OK.
  10. After the file is successfully uploaded, the mapping structure is displayed. Specify the appropriate field names and attribute values for each row in the structure.
  11. Select Save.
webrqt_mapping_fields.jpg

Step 8: Using the XSLT conversion The XSLT conversion option provides an alternative method for addressing complex data mapping requirements. Powered by the Saxon XSLT 3.0 engine, it transforms JSON input into XML format.

  1. Go to the data port configured for your API request.
  2. On the displayed page, select Format mapping. 
  3. On the Format mapping page, select Go to > Enhanced view.
  4. On the displayed pop-up, confirm the redirection from the current page by selecting Yes.
  5. The XSLT form for file conversion is displayed.

  6. From the Incoming type, choose the file format for conversion. 
  7. In the INPUT DATA, specify the script of your file that requires a conversion.
  8. Select Run to test the correct execution of the script.
  9. In the OUTPUT DATA, verify the result of the file conversion.
  10. Note: If the mapping is complex, you can manually edit the script.

  11. Select Save.
Book a 30-min review