.NET Core Console Application
In this article, you can read more about the .NET Core Console Application.
We will go through the process of setting the application up and exploring what you can do with the application. We will also discuss how you can connect to your Heartcore project on Umbraco Cloud.
In order to use this console application, you will need to have the .NET Core SDK2.2. Older or newer versions will not work with the application.
Installing the Console Application
Once you have cloned down the Umbraco Headless Client, there are two ways of running the application.
1. Using Visual Studio
Open up the Umbraco.Headless.Client.Samples.Console.sln
file located at Umbraco.Headless.Client.Net\samples\Umbraco.Headless.Client.Samples.Console
and press F5. This will launch the Console application.
2. Using the Command Line
By using the command line, you will need to run the following commands from the Umbraco.Headless.Client.Samples.Console
folder in order to run the application.
Walkthrough of the Application
In order to use this application to its fullest, you will need a Heartcore Project on Umbraco Cloud. If you do not have a project yet, you can create a trial. It is recommended that you have a project with both content and media items.
If you are connecting to a Heartcore Project with multiple environments you will have to use the alias for the Development environment.
If you do not have a project or trial you can also connect to demo-headless
.
Once you have entered the alias of the project, you are presented with the following options
Option A - E uses the Content Delivery API and can be used for any Heartcore Project, which has public content.
Option F uses the Content Management API.. This means that an API Key is required to run this part of the sample. This is because it will create a new folder in the Media Library and upload an image to a new Media item.
Examples of the fetched data
Fetching the data looks like the following.
In the example above we have fetched the Content Tree. Is shows all the Parent and Child Nodes. The Child Node is shown by an indentation.
In the next example, we have fetched the Root media.
It is showing the name of the Media items and a direct link to each of the Media items.
Last updated