Foundation API Client Library PHP – Usage Examples By: Juergen Rolf Revision Version: 1.2
Total Page:16
File Type:pdf, Size:1020Kb
Foundation API Client Library PHP – Usage Examples By: Juergen Rolf Revision Version: 1.2 Revision Date: 2019-09-17 Company Unrestricted Foundation API Client Library PHP – Installation Guide Document Information Document Details File Name MDG Foundation API Client Library PHP - Usage Examples_v1_2 external.docx Contents Usage Examples and Tutorial introduction for the Foundation API Client Library - PHP Author Juergen Rolf Version 1.2 Date 2019-09-17 Intended Audience This document provides a few examples helping the reader to understand the necessary mechanisms to request data from the Market Data Gateway (MDG). The intended audience are application developers who want to get a feeling for the way they can request and receive data from the MDG. Revision History Revision Date Version Notes Author Status 2017-12-04 1.0 Initial Release J. Rolf Released 2018-03-27 1.1 Adjustments for external J. Rolf Released release 2019-09-17 1.2 Minor bugfixes J. Ockel Released References No. Document Version Date 1. Quick Start Guide - Market Data Gateway (MDG) 1.1 2018-03-27 APIs external 2. MDG Foundation API Client Library PHP – Installation 1.2 2019-09-17 Guide external Company Unrestricted Copyright © 2018 FactSet Digital Solutions GmbH. All rights reserved. Revision Version 1.2, Revision Date 2019-09-17, Author: Juergen Rolf www.factset.com | 2 Foundation API Client Library PHP – Installation Guide Table of Contents Document Information ............................................................................................................................. 2 Document Details ................................................................................................................................................. 2 Intended Audience ............................................................................................................................................... 2 Revision History ................................................................................................................................................... 2 References ........................................................................................................................................................... 2 Table of Contents .................................................................................................................................... 3 Terminology ............................................................................................................................................. 4 Prerequisites ........................................................................................................................................... 5 1 How to Read this Document ............................................................................................................. 6 2 Application Setup .............................................................................................................................. 7 2.1 Common setup of a PHP based application ................................................................................................. 7 3 Verification of the Installation ............................................................................................................ 8 3.1 Integration of Foundation API class files ....................................................................................................... 8 3.2 Configuration of the __autoload() function .................................................................................................... 9 3.3 Connecting via the PHP extension module ................................................................................................... 9 4 Sending an Example Request ......................................................................................................... 11 4.1 Example Request to the “Echo” Endpoint from PHP Code ......................................................................... 11 4.2 Error Handling ............................................................................................................................................. 14 5 The PHP Client Library Tutorial ...................................................................................................... 14 5.1 Requests to Endpoints ................................................................................................................................ 14 5.2 Running the Client Library PHP Tutorial ..................................................................................................... 15 6 Conclusion and Outlook .................................................................................................................. 17 Company Unrestricted Copyright © 2018 FactSet Digital Solutions GmbH. All rights reserved. Revision Version 1.2, Revision Date 2019-09-17, Author: Juergen Rolf www.factset.com | 3 Foundation API Client Library PHP – Installation Guide Terminology Term Description API Application Programming Interface, a piece of software that exposes data from a system to another application. CAS Customized API Service – a server that contains customer-specific setups for back end services and hosts endpoints. Client An application that requests data from the MDG. Also a company that is a customer of FactSet Digital Solutions. Endpoint A piece of software that is located on a customized API service (see CAS). It provides an abstraction layer for back-end requests and advanced business logic. Foundation The set of defined requests and responses that the MDG exposes. Other API programs can use these to interact with the MDG. HTML Hypertext Markup Language, a language that describes documents, predominantly for display of web sites. HTTP Hypertext Transfer Protocol, the Internet’s most common transfer protocol on the application layer. HTTPS Hypertext Transfer Protocol Secure, a layer that secures transmissions over HTTP. MDG Market Data Gateway, the market data platform of FactSet Digital Solutions PTL A proprietary protocol definition language, abbreviation for Protocol Template Language. This definition language defines the internal binary serialization format of messages. TCP Transmission Control Protocol, a common connection-orientated protocol used e.g. on the internet. Company Unrestricted Copyright © 2018 FactSet Digital Solutions GmbH. All rights reserved. Revision Version 1.2, Revision Date 2019-09-17, Author: Juergen Rolf www.factset.com | 4 Foundation API Client Library PHP – Installation Guide Prerequisites This document should be read in conjunction with other documents mentioned in the text. It will guide you to understand the usage of the MDG Foundation API Client Library for PHP. You need to have access to the following resources to make use of all aspects: The installation package of the MDG Foundation API Client Library for PHP, including its documentation- and tutorial folders. 1. Login to the endpoint reference (https://endpointreference.mdgms.com/login) This is a web application that contains the documentation of the endpoints with input and output specifications. 2. Application- or User Credentials for MDG data Credentials that allow to log on to the MDG and to query FactSet Digital Solutions’ API services (e.g. in order to receive market data that is defined for a specific customer application or a user inside an application). If you are missing any of the above items, please contact your FactSet Digital Solutions contact to get access to the missing resources. Company Unrestricted Copyright © 2018 FactSet Digital Solutions GmbH. All rights reserved. Revision Version 1.2, Revision Date 2019-09-17, Author: Juergen Rolf www.factset.com | 5 Foundation API Client Library PHP – Installation Guide 1 How to Read this Document The introductory documentation of the MDG APIs is split into two parts: As indicated above, each reader should start with Part I – the Quick Start Guide and afterwards pick his desired technology from Part II – the individual Technology Guides. Each of these Technology Guides carries information on a specific client library using a different technology (e.g. PHP, Java, etc.). This document is part of the Technology Guide (Part II – documentation) of the MDG Foundation API Client Library for PHP. The MDG Foundation API Client Library for PHP allows clients to connect to and communicate with FactSet Digital Solutions’ MDG Platform. This document provides a step-by-step guide covering usage examples of the client library on a target host. The remainder of the document is structured as follows: • Chapter 2 describes the general setup of an application that uses the MDG Foundation API Client Library for PHP. • Chapter 3 provides details of how a connection can be initialized to FactSet Digital Solutions’ MDG Platform. • Chapter 4 provides details of how an endpoint can be requested from the MDG platform. • Chapter 5 shows how the tutorial available in the library can be run. • Chapter 6 provides a conclusion and outlook. Company Unrestricted Copyright © 2018 FactSet Digital Solutions GmbH. All rights reserved. Revision Version 1.2, Revision Date 2019-09-17, Author: Juergen Rolf www.factset.com | 6 Foundation API Client Library PHP – Installation Guide 2 Application Setup The MDG Foundation API Client Library for PHP can be used for many kinds of projects in different contexts. This Usage Examples document will give you an understanding of how the library can be utilized. For a better understanding of the context, this chapter describes