Replies: 2 comments
-
@marineadz there must be something else at play. The following code works perfectly fine for me: $httpClient = $odataClient->getHttpClient();
$method = "GET";
$url = "https://xxx.crm5.dynamics.com/api/data/v9.2/WhoAmI";
$headers = array();
$data = array();
$response = $httpClient->request( $method, $url, [ 'headers' => $headers, 'json' => $data, ]);
$body = $response->getBody()->getContents();
var_dump($body); Output (wrapped):
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@georged thanks so much! I was misreading the getBody() output - it wasn't an authentication error at all. What I needed was the last getContents() step. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using the toolkit extensively and it works fantastically well. However, for one particular query I need the raw OData response rather than having it converted to the usual Entity objects.
Referring to the tutorial (https://github.com/AlexaCRM/dynamics-webapi-toolkit/wiki/Tutorial#advanced-odata-usage), I want my data as noted "The data retrieved is not deserialized into Entity objects."
I've tried the following but am getting a 401 Unauthorized response - have I missed something to include the authorization?
My basic setup:
Then, in a class which has other functions using RetrieveMultiple and other standard functions that return results:
I have tested $url in my browser and it gives me JSON data as expected.
What have I missed?
Beta Was this translation helpful? Give feedback.
All reactions