Main Content

createTrigger

Create Bloomberg Hypermedia trigger for data requests

Since R2023b

Description

example

[triggerID,response] = createTrigger(c,userCatalog,payload) creates a Bloomberg® Hypermedia trigger for data requests, where c is the Bloomberg Hypermedia connection object, userCatalog is your catalog ID from Bloomberg, and payload is a structure that defines the trigger.

Examples

collapse all

Create a trigger for scheduling a request.

Create a Bloomberg Hypermedia connection object by using the API key provided by Bloomberg.

credentialsString = '{"client_id":"89beaeab724bbdf5e186b733c58af2","client_secret":"77050429aee81eb31793fb10fa4301c54911db545de8b2990252ffe2b56b11","name":"BloombergHAIDevelopment","scopes":["eap","beapData","reportingapi"],"expiration_date":1699198358934,"created_date":1651764758934}'
c = bloombergHypermedia(credentialsString)
c = 
 
  bloombergHypermedia with properties:

      TimeOut: 200.00

Specify your catalog ID and create the payload structure that holds the essential query information required by the Bloomberg Hypermedia data server. Replace "123" with your login credentials for the catalog you want to access.

userCatalog = "123";
payload.type = "PricingSnapshotTrigger";
payload.identifier = "dailySnap5PM";
payload.title = "Daily 5 PM snapshot";
payload.description = "Daily job for 5 PM snapshot";
payload.snapshotTime = "17:00:00";
payload.snapshotTimeZoneName = "America/New_York";
payload.snapshotDate = "2022-06-24";
payload.frequency = "daily";
 

Use the createTrigger function to create the trigger.

[triggerID,response] = createTrigger(c,userCatalog,payload)
triggerID = 
  
      "dailySnap5PM"
  
response = 
  
    ResponseMessage with properties:
  
      StatusLine: 'HTTP/1.1 201 CREATED'
      StatusCode: Created
          Header: [1x14 matlab.net.http.HeaderField]
            Body: [1x1 matlab.net.http.MessageBody]
       Completed: 0

After creating the trigger, you can use this output to create a data request by using the createRequest function.

Input Arguments

collapse all

Bloomberg Hypermedia connection, specified as a Bloomberg Hypermedia object.

User catalog identifier, specified as a character vector or string scalar.

Trigger information, specified as a structure array.

Output Arguments

collapse all

Trigger identifier, returned as a string scalar.

HTTP request response, returned as a ResponseMessage object. For details, see matlab.net.http.ResponseMessage.

Version History

Introduced in R2023b