Skip to content

Commit 81d4291

Browse files
Merge pull request #12 from microsoftgraph/edit-readme
Edit readme
2 parents eef4fe9 + 32ef267 commit 81d4291

File tree

1 file changed

+45
-21
lines changed

1 file changed

+45
-21
lines changed

readme.md

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# Microsoft Graph Core SDK for Java
22

3-
[ ![Download](https://api.bintray.com/packages/microsoftgraph/Maven/microsoft-graph/images/download.svg) ](https://bintray.com/microsoftgraph/Maven/microsoft-graph/_latestVersion)
4-
5-
63
Get started with the Microsoft Graph Core SDK for Java by integrating the [Microsoft Graph API](https://graph.microsoft.io/en-us/getting-started) into your Java application!
74

85
## 1. Installation
96

107
### 1.1 Install via Gradle
118

12-
Add the repository and a compile dependency for `microsoft-graph` to your project's `build.gradle`:
9+
Add the repository and a compile dependency for `microsoft-graph-core` to your project's `build.gradle`:
1310

1411
```gradle
1512
repository {
@@ -70,33 +67,59 @@ Register your application by following the steps at [Register your app with the
7067

7168
### 2.2 Create an IAuthenticationProvider object
7269

73-
An instance of the **GraphServiceClient** class handles building requests, sending them to the Microsoft Graph API, and processing the responses. To create a new instance of this class, you need to provide an instance of `IAuthenticationProvider`, which can authenticate requests to Microsoft Graph.
74-
75-
For an example of authentication in a client application, see the [MSGraph SDK Android MSA Auth for Android Adapter](https://github.com/microsoftgraph/msgraph-sdk-android-msa-auth-for-android-adapter).
70+
An instance of the **HttpClients** class handles building client. To create a new instance of this class, you need to provide an instance of `ICoreAuthenticationProvider`, which can authenticate requests to Microsoft Graph.
7671

77-
### 2.3 Get a HttpClient object
78-
You must get a **HttpClient** object to make requests against the service.
72+
### 2.3 Get a HttpClients object
73+
You must get a **HttpClients** object to make requests against the service.
7974

8075
```java
81-
CloseableHttpClient httpClient = HttpClients.createDefault(authenticationProvider);
76+
OkHttpClient client = HttpClients.createDefault(iCoreAuthenticationProvider);
8277
```
8378

8479
## 3. Make requests against the service
8580

86-
After you have a HttpClient that is authenticated, you can begin making calls against the service. The requests against the service look like our [REST API](https://developer.microsoft.com/en-us/graph/docs/concepts/overview).
81+
After you have a HttpClients that is authenticated, you can begin making calls against the service. The requests against the service look like our [REST API](https://developer.microsoft.com/en-us/graph/docs/concepts/overview).
8782

88-
### 3.1 Get the user's drive
83+
### 3.1 Get the user's details
84+
85+
To retrieve the user's details
86+
87+
```java
88+
Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/me/").build();
89+
90+
client.newCall(request).enqueue(new Callback() {
91+
@Override
92+
public void onResponse(Call call, Response response) throws IOException {
93+
String responseBody = response.body().string();
94+
// Your processing with the response body
95+
}
96+
97+
@Override
98+
public void onFailure(Call call, IOException e) {
99+
e.printStackTrace();
100+
}
101+
});
102+
```
103+
104+
### 3.2 Get the user's drive
89105

90106
To retrieve the user's drive:
91107

92108
```java
93-
HttpGet httpget = new HttpGet("https://graph.microsoft.com/v1.0/me/");
94-
try{
95-
HttpResponse response = httpclient.execute(httpget);
96-
//...
97-
}catch(IOException e){
98-
//Handle exception
99-
}
109+
Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/me/drive").build();
110+
111+
client.newCall(request).enqueue(new Callback() {
112+
@Override
113+
public void onResponse(Call call, Response response) throws IOException {
114+
String responseBody = response.body().string();
115+
// Your processing with the response body
116+
}
117+
118+
@Override
119+
public void onFailure(Call call, IOException e) {
120+
e.printStackTrace();
121+
}
122+
});
100123
```
101124

102125
## 4. Issues
@@ -105,11 +128,12 @@ For known issues, see [issues](https://github.com/MicrosoftGraph/msgraph-sdk-jav
105128

106129
## 5. Contributions
107130

108-
The Microsoft Graph SDK is open for contribution. To contribute to this project, see [Contributing](https://github.com/microsoftgraph/msgraph-sdk-java/blob/master/CONTRIBUTING.md).
131+
The Microsoft Graph SDK is open for contribution. To contribute to this project, see [Contributing](https://github.com/microsoftgraph/msgraph-sdk-java-core/blob/master/CONTRIBUTING.md).
109132

110133
<!-- ALL-CONTRIBUTORS-LIST:START -->
111134
<!-- prettier-ignore -->
112-
[<img src="https://avatars2.githubusercontent.com/u/3197588?v=4" width="100px;"/><br /><sub><b>Deepak Agrawal</b></sub>](https://github.com/deepak2016)<br />[💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=deepak2016 "Code")
135+
| [<img src="https://avatars2.githubusercontent.com/u/3197588?v=4" width="100px;"/><br /><sub><b>Deepak Agrawal</b></sub>](https://github.com/deepak2016)<br />[:computer:](https://github.com/microsoftgraph/msgraph-sdk-java-core/commits?author=deepak2016 "Code") | [<img src="https://avatars3.githubusercontent.com/u/16473684?v=4" width="100px;"/><br /><sub><b>Nakul Sabharwal</b></sub>][:computer:](https://github.com/microsoftgraph/msgraph-sdk-java-core/commits?author=NakulSabharwal "Code")<br />[](#question-NakulSabharwal "Answering Questions") [](https://github.com/microsoftgraph/msgraph-sdk-android-auth/commits?author=NakulSabharwal "Code") [](https://github.com/microsoftgraph/msgraph-sdk-android-auth/wiki "Documentation") [:clipboard:](#review-NakulSabharwal "Reviewed Pull Requests") [](https://github.com/microsoftgraph/msgraph-sdk-android-auth/commits?author=NakulSabharwal "Tests") <br />
136+
| :---: | :---: |
113137
<!-- ALL-CONTRIBUTORS-LIST:END -->
114138

115139
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!

0 commit comments

Comments
 (0)