How to make use of “category” according to “A.3.4 Field Search Request” of developers guide? The Bloomberglp.Blpapi.dll is from blpapi_dotnet_3.4.8.1., development by C# .net.
I used the following code in order to get the information but it does not work.
Service refDataSvc = session.GetService("//blp/refdata");
Request request = refDataSvc.CreateRequest("ReferenceDataRequest");
request.Append("securities", "/isin/CNE1000002Q2 HK");
Element element = request.GetElement("include");
element.SetElement("productType", "Equity");
element.SetElement("fieldType", "Static");
Element element1 = element.GetElement("category");
element1.AppendValue("Ratings");
element1.AppendValue("Analysis");
element1.AppendValue("Corporate Actions");
session.SendRequest(request, null);
I also tried other ways
a)
Service refDataService = session.GetService("//blp/refdata");
Request request = refDataService.CreateRequest("ReferenceDataRequest");
Element securities = request.GetElement("securities");
securities.AppendValue("IBM US Equity");
Element fields = request.GetElement("fields");
fields.AppendValue("PX_LAST");
Element element1 = fields.GetElement("category");
element1.AppendValue("Corporate Actions");
session.SendRequest(request, null);
b)
Service refDataService = session.GetService("//blp/refdata");
Request request = refDataService.CreateRequest("ReferenceDataRequest");
Element securities = request.GetElement("securities");
securities.AppendValue("IBM US Equity");
Element element1 = request.GetElement("category");
element1.AppendValue("Corporate Actions");
session.SendRequest(request, null);
Both are not successful.
Could anyone advise me on this?
Related
I'm trying to get the PKCE example to work, but I keep hitting
Error code: 500
Error: invalid_request : code challenge required
Here's a sample url, it does include a code_challenge param generated with the example code.
https://login.xero.com/identity/connect/authorize
?client_id=XXX
&response_type=code
&scope=openid%20profile%20email%20offline_access%20files%20accounting.transactions%20accounting.contacts&redirect_uri=https%3A%2F%2Flocalhost%3A5001%2F
&code_challenge=tj6n3SLd6FZ8g6jjSJYvfC--4r2PHGnpbSGTwIreNqQ
&code_challenge_method=S256
The registered app is a PKCE flow, kind of out of options what it could be.
Here's the code I use, the only changes are the last 2 lines where I launch the browser a I'm connecting from a desktop app. Tried pasting the generated url into the browser directly but that also didn't work.
XeroConfiguration xconfig = new XeroConfiguration();
xconfig.ClientId = "XXX";
xconfig.CallbackUri = new Uri("https://localhost:5001"); //default for standard webapi template
xconfig.Scope = "openid profile email offline_access files accounting.transactions accounting.contacts";
//xconfig.State = "YOUR_STATE"
var client = new XeroClient(xconfig);
// generate a random codeVerifier
var validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~";
Random random = new Random();
int charsLength = random.Next(43, 128);
char[] randomChars = new char[charsLength];
for (int i = 0; i < charsLength; i++) {
randomChars[i] = validChars[random.Next(0, validChars.Length)];
}
string codeVerifier = new String(randomChars);
var uri = client.BuildLoginUriPkce(codeVerifier);
Clipboard.SetText(uri);
System.Diagnostics.Process.Start("explorer.exe", $"\"{uri}\"");
In Shopify ORDERS API, I use
/admin/api/2021-01/orders/count.json
In order to get the orders count, so I wanted to get all the orders. And by followign the REST API Documentation, I used two endpoints to do this.
/admin/api/2021-01/orders.json?status=any
/admin/api/2021-01/orders.json?limit=250&status=any; rel=next
First I would request the orders using the first endpoint where I get up to 50 orders/items in a list.
Then by using the counter as a limit, lets say I have 550 orders that I got from the response of orders/count.json
I do:
accumulated = []
iter = 0
while True:
if len(accumulated) > count:
break
if iter != 1:
url = #user first url
else:
url = $use second url that has next
items = #make a request here for that url and save each order item
accumulated+=items #this saves each list to the accumulated list so we know that we hit the count
But for some reason im only getting a fraction of the count. Lets say out of 550 on count, I only get 350 that are not duplicates of each other. Im thinking that maybe the second url, only requests the second page and doesnt proceed to the third page. Hence I was doing
first iteration = first page
second iteration = second page
third iteration = second page
all those gets into the accumulated list and stops the loop because of the condition that when accumulated exceeds count the loop will stop.
How can I make it so when I request ORDERS Endpoint in shopify. I go from the next pages properly?
I tried following shopify's tutorial in making paginated requests, but its unclear for me. on how to use it. THeres this page_info variable thats hard to me to understand where to find it and how to use it.
Hy! In Shopify REST api you can get max 250 orders per api call and if there are more orders you get LINK from header which contain URL for your next page request like
Here you can see I have LINK variable in my response headers you just need to get this LINK and check for rel='next' flag
But keep in mind when you hit the new URL and still you have more orders to fetch then the Header sent LINK with two URL 1 for Previous and 1 for the next.
run this snippet to get LINK from headers
var flag = false;
var next_url = order.headers.link;
if(next_url){
flag = true
next_url = next_url.replace("<","");
next_url = next_url.replace(">", "");
var next_url_array = next_url.split('; ');
var link_counter_start = next_url_array[0].indexOf("page_info=")+10;
var link_counter_length = (next_url_array[0].length);
var next_cursor="";
var link_counter;
for(link_counter=link_counter_start; link_counter<link_counter_length; link_counter++){
next_cursor+=(next_url_array[0][link_counter])
}
}
for the very first api But if you have more then two pages use the following code to seprate next link from previos and next flag
next_url = order.headers.link;
var next_url_array,
link_counter_start, link_counter_length,
link_counter;
if(next_url.includes(',')){
next_url = next_url.split(',');
next_url = next_url[1];
}
next_url = next_url.replace("<","");
next_url = next_url.replace(">", "");
next_url_array = next_url.split('; ');
link_counter_start = next_url_array[0].indexOf("page_info=")+10;
link_counter_length = (next_url_array[0].length);
next_cursor="";
for(link_counter=link_counter_start; link_counter<link_counter_length; link_counter++){
next_cursor+=(next_url_array[0][link_counter])
}
if(next_url_array[1] != 'rel="next"'){
flag = false;
}
I'm trying to create an url widget using below code to allow the document be signed by multiple signers. But when I upload the document, an extra signature box appears at the beginning, then the remaining signature boxes appear for each email address I mention in the WidgetCreationInfo.CounterSigners property. I need to remove the extra signature box from the document.
var senderInfo = new com.echosign.secure22.SenderInfo();
senderInfo.email = "abx#xyz.com";
senderInfo.password = "******";
var widgetInfo = new com.echosign.secure22.WidgetCreationInfo();
widgetInfo.name = "test widget";
widgetInfo.fileInfos = new EchoSign.com.echosign.secure22.FileInfo[1];
widgetInfo.fileInfos[0] = new EchoSign.com.echosign.secure22.FileInfo();
widgetInfo.fileInfos[0].file = System.IO.File.ReadAllBytes(fileName);
widgetInfo.fileInfos[0].fileName = System.IO.Path.GetFileName(fileName);
widgetInfo.callbackInfo = new com.echosign.secure22.CallbackInfo();
widgetInfo.callbackInfo.signedDocumentUrl = redirectUrl;
widgetInfo.signatureFlow = EchoSign.com.echosign.secure22.SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED;
widgetInfo.counterSigners = new com.echosign.secure22.RecipientInfo[2];
widgetInfo.counterSigners[0] = new com.echosign.secure22.RecipientInfo();
widgetInfo.counterSigners[0].email = "abc#gmail.com";
widgetInfo.counterSigners[0].role = com.echosign.secure22.RecipientRole.SIGNER;
widgetInfo.counterSigners[0].roleSpecified = true;
widgetInfo.counterSigners[1] = new com.echosign.secure22.RecipientInfo();
widgetInfo.counterSigners[1].email = "xyz#yahoo.com";
widgetInfo.counterSigners[1].role = com.echosign.secure22.RecipientRole.SIGNER;
widgetInfo.counterSigners[1].roleSpecified = true;
var result = ES22.createEmbeddedWidget(apiKey, senderInfo, widgetInfo);
Can anyone please help?
The first signature block is for the widget signer. The rest of the recipients you have added are counter signers and would need to sign once the first signer of the widget signs. If you simply need a document to be signed by multiple signers, you can create a normal agreement instead of a widget. If yow want to host the signing page, you can use eSign services API to retrieve the signing URL of the signers in the agreement. Let me know if this helps.
How do you explicitly request fx forwards as outrights using the bloomberg API?
In the Bloomberg terminal you can choose whether to get FX Forwards as absolute rates (outrights) or as offsets from Spots (Points) by doing XDF, hitting 7, then the option is about half way down. 0 means outrights, and 1 means offfsets.
With most defaults you can explicitly set them in the API, so your code gives the same result whichever computer you run on. How do you set this one in a V3 API query?
Having had a colleague told by the help desk this is impossible, it turns out they are wrong and it is possible. You override the FWD_CURVE_QUOTE_FORMAT to be RATES for absolute and POINTS as offsets.
Example code (Java):
public static void main(String [] args) throws Exception{
Session session = BlpUtil.connectToReferenceData();
Service refDataService = session.getService("//blp/refdata");
Request request = refDataService.createRequest("HistoricalDataRequest");
Element securities = request.getElement("securities");
securities.appendValue("JPY10Y CMPL Curncy");
Element fields = request.getElement("fields");
fields.appendValue("PX_LAST");
request.set("startDate", "20100527");
request.set("endDate", "20100527");
Element overrides = request.getElement("overrides");
Element override1 = overrides.appendElement();
override1.setElement("fieldId", "FWD_CURVE_QUOTE_FORMAT");
override1.setElement("value", "POINTS");
CorrelationID cid = session.sendRequest(request, null);
while (true) {
Event event = session.nextEvent();
MessageIterator msgIter = event.messageIterator();
while (msgIter.hasNext()) {
Message msg = msgIter.next();
if (msg.correlationID() == cid) {
System.out.println("msg = " + msg);
}
}
}
}
I have a web service , i add some extra class which have message contract and after that it changed the way we access some of the methods( and i have not added message contract to these classes these are data contracts ), earlier i.e before we could create one object for request and response (like see the Before part) we are creating a single object for OrderStatusResponse Class. But if you see now the After(we have to create separate objects for request and response).
is this a side effect of enabling "Always generate message contract?"
Before
SmartConnect.Service1Client Client =
new SmartConnectClient.SmartConnect.Service1Client();
SmartConnect.OrderStatusResponse Status =
new SmartConnectClient.SmartConnect.OrderStatusResponse();
Status.UserID = "1234";
Status.Password = "abcd";
Status.SoftwareKey = "abc";
Status.OrderNumber = "1234";
Status = Client.GetOrderStatus(Status);
lbl_OS.Text = Status.Status.ToString();
lbl_RM.Text = Status.ReturnMessage.ToString();
After
SmartConnectRepublic.SmartConnectClient SmartClient =
new WCF_Client.SmartConnectRepublic.SmartConnectClient();
//SmartConnectRepublic.OrderStatusResponse Status =
new WCF_Client.SmartConnectRepublic.OrderStatusResponse();
WCF_Client.SmartConnectRepublic.GetOrderStatusRequest request =
new WCF_Client.SmartConnectRepublic.GetOrderStatusRequest();
request.status = new WCF_Client.SmartConnectRepublic.OrderStatusResponse();
request.status.OrderNumber = "1055055";
request.status.UserID = "1234";
request.status.Password = "dfsdfsd";
request.status.SoftwareKey = "sdfsdfsdfs";
WCF_Client.SmartConnectRepublic.GetOrderStatusResponse response =
new WCF_Client.SmartConnectRepublic.GetOrderStatusResponse();
response = SmartClient.GetOrderStatus(request);
lbl_Status.Text = response.GetOrderStatusResult.Status;
lbl_RC.Text = response.GetOrderStatusResult.ReturnCode.ToString();
lbl_RM.Text = response.GetOrderStatusResult.ReturnCode.ToString();
Yes, I suspect it is a difference with using message contracts. You seem to have figured it out, though.