Office 365 REST Access to OData is disabled - rest

I've been trying to connect to Office 365 REST Api to fetch user- and room calendar data. I'm able to obtain access tokens and all that, but every time I make a query I get the same response:
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access to OData is disabled."
}
}
I get the same reply from the oauth playground as well (https://oauthplay.azurewebsites.net/).
I'm aware that in order to access resource calendar data I need to create a service app with a generated certificate (as described here: http://blogs.msdn.com/b/exchangedev/archive/2015/01/22/building-demon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow.aspx).
But since I cannot get event the basic information to flow, I guess there's something wrong with the office365 setup?
Thanks for your help!

Related

Using service accounts and oauth2 to call autoML Google API

I've trained an image classification model using autoML API and now I would like to create a JAVA program that makes predictions of given images using that model. As mentioned in the docs, this API requires the OAuth scope: https://www.googleapis.com/auth/cloud-platform.
I don't need the user to login since I will not use any private data, so I decided to use service accounts and followed the steps in OAuth2 for service accounts to generate an access token.
The process goes well and I receive the reponse:
{"access_token": "access_token_string", "expires_in": 3600, "token_type": "Bearer"}
Then, I go back to send the post request for autoML prediction, and set the header "Authorization" to "Bearer access_token_string".
I have the error message
{"error":
{
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
I know that the prediction request is correct because I've tried it using an accessToken generated for web apps (just wanted to test).
So the problem is in the authorization part, I've checked that my service account have all the required permissions as well. I d'ont know where the problem is exactly, does anyone have an idea?
So since there are no answers, I contacted the Google Support Service, they told me that the below requests are correct, the problem is in allowing the service account to access my GCP project resources. This step is explained here
I've already went through this step but I should have missed something the first time, so I deleted the service account and restarted all the steps, it's working now!
I hope this will help someone :)

"PERMISSION_DENIED" on Google Spreadsheet REST API v4

I try to read data from google sheet via http. I use v4 google spreadsheet api:
https://sheets.googleapis.com/v4/spreadsheets/1MZJEOzkzy5iJ9HPy2GU-Ky3vdaIzGGDQH8BMt4n3OGI/values/Sheet1!A1:D5
I get:
{
"error": {
"code": 403,
"message": "The request cannot be identified with a client project. Please pass a valid API key with the request.",
"status": "PERMISSION_DENIED"
}
}
Sheet is published online and everyone can edit it. It works on api v3 too.
First, make sure you have a permission to call this spreadsheet and you enable the Sheets API in your developer console. You can also try to change the privacy settings of this spreadsheet to public and checked if you can access it now. This 403 error is usually caused by incorrect or missed some configuration in Authorizing Requests. If you authorizing requests with OAuth 2.0, make sure you use the proper scope with it.
For more information, you can check this thread on how to debug your Google OAuth 2.0 token when you get HTTP 401s or 403s
You have to append the string "key=yourAPIkey" as query on your URI. The API key is generated in the developer's console
If you update application access scope you have to re-authenticate the application and update credentials.json.
In google-sheet quick start guide, they have started the tutorial with only read scope. If you want to write or update google-sheet later you will have to change the scope there and update the credentials.json again
Look carefully when you first authenticate it only giving permission to read. But if update scope and try to re-authenticate it will ask for permission to read and manage sheet permission.
In order to update the scopes, you need to remove the token file saved in TOKENS_DIRECTORY_PATH, execute the code again and log in. Then Oauth2 will give you the new updated tokens.

Authentication error when accessing public SODA endpoint

I am using SharePoint Designer 2013 to author a workflow and using the "Call HTTP Web Service" access to access the soda endpoint https://health.data.ny.gov/resource/7xgt-tyms.json?fac_id=1
The response I get is the following json object
{"code":"authentication_required","error":true,"message":"Authentication
failed: Unsupported authorization type"}
but, as far as I can tell, this end point does not require authentication. I've also tried it with my own app token and received the same result. I was able to get this workflow to work using Microsoft's sample odata endpoint that they provide at http://services.odata.org/V3/Northwind/Northwind.svc/Customers('ALFKI')?$format=json&$select=ContactName,CompanyName
Why don't you try our OData endpoint for that dataset? It might work better out of the box with Sharepoint Designer.
http://dev.socrata.com/odata/

product catalog api fail

need help.
I tried to start with https://developers.facebook.com/docs/marketing-api/dynamic-product-ads/ads-management/v2.3
created account. Approved it by phone.
created a business account, an ad account, an app, and so on.
linked app to ad accont like this https://developers.facebook.com/docs/marketing-api/access#standard_accounts.
Now i tried to create product catalog. i am getting same error all the time:
The app is not whitelisted to use this API
i tried to call api to cteate/list/managment product catalog.
when i did, the same by UI - i can create product catalog & feed.
but by API - all time error.
i do not understand what it need?
now try to create product set:
GET /<product_catalog ID>/product_sets/?
access_token=<my access token from app with full rights get from exploer>
{
"error": {
"message": "(#200) The app is not whitelisted to use this API",
"type": "OAuthException",
"code": 200
}
}
try to create the same:
POST : /v2.3/<product_catalog ID>/product_sets/?access_token=<my access token from app with full rights get from exploer>&name=my new prod set
{
"error": {
"message": "(#275) Ad account cannot be determined for this request",
"type": "OAuthException",
"code": 275
}
}
So what Are the changes i needed to make it work?
is it any way to made api calls work correctly?
p.s.
i guess something wrong in settings - i run unit tests in SDK - have the same situation. i have read about that problems with game app - but my app - is not a game, so i cant use solution in my situation.
if some body understand what whitelist API want - please help!
Thanks.
Hopefully this helps someone else: I was also trying to create a Product Catalog via the API in Development, and got "The app is not whitelisted to use this API".
I solved it by creating an admin system user, and generating an access token with the business_management permission.
The error is explained by the documentation you linked to - unless your app is approved for Standard access to the API it can only access a specific number of ad accounts and those accounts need to be pre-configured in the app settings
Many of the business manager APIs can't be used because they're not tied to one of those pre-specified accounts (hence the Ad account cannot be determined for this request error).
In general, the business manager APIs likely won't work for you until your app has access at the standard level, though some will if they're account-specific
You can't be an app admin and a tester/developer at the same time. You should create another facebook account for tests.
This happens also when the access token used is not from your app which has Standard Access. Also, note the dev version of the same app will not work.

getting started with google directory API and device management

Heyy, I was looking into Google apps for business and playing with the API explorer ... I have a reseller account with google let's say stack#reseller.goteam.com and this works for creating users, org units, subscriptions and so.
I want to start with the device management and investigating on these things:
1) How do I know my customerId from google cpanel ... I am looking to know how to see the info required for these requests in CPanel.
2) I am getting the below error:
400 Bad Request
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
In my request, I entered "goteam.com" as customerId..... Isn't this correct? any good posts on getting started with device management.... Please help
there are 2 basic ways to determine what customerId you need to use:
Just use my_customer, this will use the customerId of the user you authenticated as. This works perfect when working with your own domain but will not work when when you are a reseller trying to access one of your customer's domain data.
Use the users.list() API call to determine the customerId. Specify the domain, a maxResult of 1 and that the only field you want back is customerId. Here's what it'd look like in the API Explorer.
The customerId is not your domain, it's a unique ID that looks like random characters.
Lastly, you should be aware that resellers currently can't make device management requests for customers (see note near top).
I agree with Jay. Currently resellers cannot utilize the Directory API on behalf of their customers. The Provisioning API does however, work.