No response/results
I'm trying a SKY API example in a new Visual Studio 2017 console application (.net framework - 4.7.1). When I attempt do debug the application, all I get is "The program '[25704] ConsoleApp1.exe' has exited with code 0 (0x0)". I'm expecting the application to wait for a response and eventually show me the response as the SKY Api [Try it!] page does. Can anyone tell me what I'm missing. Thanks
using System.Threading.Tasks;
using System.Net.Http.Headers;
using System.Net.Http;
using System.Web;
static void Main(string[] args)
{
MakeRequest();
}
static async void MakeRequest()
{
try
{
using (HttpClient client = new HttpClient())
{
var queryString = HttpUtility.ParseQueryString(string.Empty);
client.DefaultRequestHeaders.Add("Bb-Api-Subscription-Key", "08538c8a0c16416eaf00axxxxxxxxxxxxxx");
client.DefaultRequestHeaders.Add("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjREVjZzVkxIM0FtU1JTbUZqMk04Wm5wWHU3WSJ9.eyJuYW1laWQiOiI0ZTU0MGExMC03Y2IxLTQxZTYtYjNhYS0xMzUwMGYyYWMzODIiLCJhcHBsaWNhdGlvbmlkIjoiYTA1NmNhNmItYTNhOC00YWM3LWIzMjUtOTk3NjY2MzA2ZTUyIiwiZW52aXJvbm1lbnRpZCI6InAtSnEySFBfYlBUa3lMLWYzZzd2MFJhQSIsImVudmlyb25tZW50bmFtZSI6Ik1ITVIgb2YgVGFycmFudCBDb3VudHkgUHJvZHVjdGlvbiBFbnZpcm9ubWVudCIsImxlZ2FsZW50aXR5aWQiOiJwLUVnMnY3c0VONTBhcXdVN1VxOWpTWmciLCJsZWdhbGVudGl0eW5hbWUiOiJNSE1SIG9mIFRhcnJhbnQgQ291bnR5Iiwiem9uZSI6InAtdXNhMDEiLCJpc3MiOiJodHRwczovL29hdXRoMi5za3kuYmxhY2tiYXVkLmNvbS8iLCJhdWQiOiJibGFja2JhdWQiLCJleHAiOjE1Nzk2NDM1NDksIm5iZiI6MTU3OTYzOTk0OX0.aq1NAfqaFBrozJ3NGT5jRdfYCDrE3cavyge82gsuwfymqPHI7CwlTWYzA_imXNL1jYi62fwRUaD8DqzYXC7vguo3ZLjLjmGx9TmLKven7gCxDr4w_jPJe9q_AFgQmt9MVW6xKGaZKmmcFzE3TfL7n4vP4KvUER-FKPW5mQduy3-HeAgMFNJ3KALKV26acFAQOEhC6cjLmxldO2lSeEPK4xnN7ONdTEhW-cSbU4GhmPhCo7q-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
queryString["limit"] = "6";
var _uri = "https://api.sky.blackbaud.com/generalledger/v1/journalentrybatches?" + queryString;
var response = await client.GetAsync(_uri);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
using System.Threading.Tasks;
using System.Net.Http.Headers;
using System.Net.Http;
using System.Web;
static void Main(string[] args)
{
MakeRequest();
}
static async void MakeRequest()
{
try
{
using (HttpClient client = new HttpClient())
{
var queryString = HttpUtility.ParseQueryString(string.Empty);
client.DefaultRequestHeaders.Add("Bb-Api-Subscription-Key", "08538c8a0c16416eaf00axxxxxxxxxxxxxx");
client.DefaultRequestHeaders.Add("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjREVjZzVkxIM0FtU1JTbUZqMk04Wm5wWHU3WSJ9.eyJuYW1laWQiOiI0ZTU0MGExMC03Y2IxLTQxZTYtYjNhYS0xMzUwMGYyYWMzODIiLCJhcHBsaWNhdGlvbmlkIjoiYTA1NmNhNmItYTNhOC00YWM3LWIzMjUtOTk3NjY2MzA2ZTUyIiwiZW52aXJvbm1lbnRpZCI6InAtSnEySFBfYlBUa3lMLWYzZzd2MFJhQSIsImVudmlyb25tZW50bmFtZSI6Ik1ITVIgb2YgVGFycmFudCBDb3VudHkgUHJvZHVjdGlvbiBFbnZpcm9ubWVudCIsImxlZ2FsZW50aXR5aWQiOiJwLUVnMnY3c0VONTBhcXdVN1VxOWpTWmciLCJsZWdhbGVudGl0eW5hbWUiOiJNSE1SIG9mIFRhcnJhbnQgQ291bnR5Iiwiem9uZSI6InAtdXNhMDEiLCJpc3MiOiJodHRwczovL29hdXRoMi5za3kuYmxhY2tiYXVkLmNvbS8iLCJhdWQiOiJibGFja2JhdWQiLCJleHAiOjE1Nzk2NDM1NDksIm5iZiI6MTU3OTYzOTk0OX0.aq1NAfqaFBrozJ3NGT5jRdfYCDrE3cavyge82gsuwfymqPHI7CwlTWYzA_imXNL1jYi62fwRUaD8DqzYXC7vguo3ZLjLjmGx9TmLKven7gCxDr4w_jPJe9q_AFgQmt9MVW6xKGaZKmmcFzE3TfL7n4vP4KvUER-FKPW5mQduy3-HeAgMFNJ3KALKV26acFAQOEhC6cjLmxldO2lSeEPK4xnN7ONdTEhW-cSbU4GhmPhCo7q-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
queryString["limit"] = "6";
var _uri = "https://api.sky.blackbaud.com/generalledger/v1/journalentrybatches?" + queryString;
var response = await client.GetAsync(_uri);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
0
Comments
-
Hello again Richard,
Our team doesn't generally get into helping with general coding issues, so hopefully someone else in the community can help you in depth. At a glance, I would have expected something within Main to wait on your call to MakeRequest. Within MakeRequest, I would have expected you to print the results of your request (or otherwise write something to the console to indicate that it did what you wanted). If nothing else, try to Debug and walk through your app to see where isn't falling down.
Might be helpful: https://docs.microsoft.com/en-us/archive/blogs/benjaminperkins/how-to-call-an-async-method-from-a-console-app-main-method1 -
Chris;
Thanks again. Actually I found the answer on Stackoverflow which I will share below for other Newbies like me to the SKY Api. I did take a look at the article you suggested and it pretty much made the exact same points.
thanks again.
https://stackoverflow.com/questions/29705607/getasync-in-httpclient-doesnt-work-as-expected
btw,.... at your convenience take you take a peek at the 1 unanswered post I put about Journal Entry Batch file submission/creation. Greatly appreciate it. This is pretty much a former or latter question. Thanks.0
Categories
- All Categories
- 6 Blackbaud Community Help
- 209 bbcon®
- 1.4K Blackbaud Altru®
- 394 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 359 Blackbaud eTapestry®
- 2.5K Blackbaud Financial Edge NXT®
- 646 Blackbaud Grantmaking™
- 563 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 934 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.4K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 243 ResearchPoint™
- 118 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 238 The Tap (Just for Fun)
- 33 Blackbaud Community Challenges
- 28 PowerUp Challenges
- 3 (Open) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 779 Community News
- 2.9K Jobs Board
- 53 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)

