I am trying to run some queries on Microsoft Academic Graph using their API. I cannot figure out what to use for the Ocp-Apim-Subscription-Key. (I have seen this question and it did not help.) When I try to run queries I get the following message (401: access denied): Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key.. This happens either using curl on the command line:
curl -v -X GET "https://westus.api.cognitive.microsoft.com\
/academic/v1.0/evaluate?\
expr=stochastic&model=latest&count=10&offset=0&attributes=Id" \
-H "Ocp-Apim-Subscription-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
or using the API testing console.
So what am I using for the Ocp-Apim-Subscription-Key? (Not a lot of Xs!) I've tried two things. First, I've tried using the key that you can get by going to https://labs.cognitive.microsoft.com/en-us/project-academic-knowledge and clicking on the subscribe link (either Key 1 or Key 2).
Second, I've tried using a key generated by going to the cognitive services on my azure portal, and trying to create a subscription to a suitable service. However, nothing that I can see matches the Academic Search API that I want to use, so I used a generic bing search subscription.
Neither of these grants me access to the API. What am I missing?
EDIT:
After first response by #ali-heikal, I tried going to here: https://dev.labs.cognitive.microsoft.com/docs/services/56332331778daf02acc0a50b/operations/5951f78363b4fb31286b8ef4/console. A red warning box appears at top of page: You are not subscribed to this API and will get a '401 Access Denied' response. To subscribe, go to the Products page and click on the desired product containing this API.. If I go to the Products page, and go on to the Project Academic Knowledge - Preview page, I am offered the chance to subscribe. Clicking subscribe takes me to a generic MS sign in (I am signed in, choose that account), I am taken to a page which says:
We're unable to complete your request
Microsoft account is experiencing technical problems. Please try again later.
So this does not work for me. Where is it documented that I should use this endpoint? Can someone provide further instructions on how to use it?
EDIT2:
There is this answer which describes using a different endpoint: https://stackoverflow.com/a/49318405/54557. However, changing my curl request to use this does not work (with same Access denied error).
You're using the wrong endpoint, since you're using the Preview API, then you should use the Preview endpoint as well.
It should work if you follow those steps:
Regenerate a key from here (do not use an old key this time) and confirm by clicking the Yes, regenerate this key button
Open the Testing Console from here
Insert the key you just generated into the Ocp-Apim-Subscription-Key field
Insert the following into the Request body field: expr=Composite(AA.AuN=='ali heikal')&count=2&attributes=Ti,Y,CC,AA.AuN,AA.AuId
Click the Send button
Check the Entity Attributes documentation here to understand the attributes I included following the Evaluate Method documentation here
I think the problem is that you are using an old key with the wrong endpoint and attribute values.
Related
I'm trying to setup a Documentation for my API specification in Postman. My problem right now is that if I modify something on the Open API screen, my documentation does not get updated.
Right now the only way to update it is to delete it and create it again. Any idea how to auto refresh it without doing that? (if it's possible)
I have added this screenshot to help understand what exactly I am using:
You don't have to delete the collection every time, you can update previously generated API elements (such as Documentation, Tests etc) through the UI:
Open the Documentation tab
Click Validate against Definition at the top-right
Click Issues Found and access the Issue summary
Select the changes and Apply
The documentation for that can be found here: https://learning.postman.com/docs/designing-and-developing-your-api/validating-elements-against-schema/#updating-api-elements
And here's a video showing you how to do it: https://youtu.be/BUZiRtGRHj0?t=340
At the moment it is not possible to trigger an update automatically whenever the schema is changed, but you could use the Postman API to pull changes on a regular basis using the Sync relation with schema endpoint:
https://www.postman.com/postman/workspace/postman-public-workspace/documentation/12959542-c8142d51-e97c-46b6-bd77-52bb66712c9a
refer to this link we integrated CustomPermissionClaimHandler to our server without any errors but still we can't get the permissions of the users... I know how to create custom claims refer to this link and if I follow these 2 links' steps, I can create permission field like a textbox as shown on picture (testClaim and organizationID are examples about that from picture)... I thought that after integrating CustomPermissionClaimHandler I would see permissions like Role field as shown on picture with blue line but still it comes with empty textbox as shown on picture with green line. Is there any way to get the permissions?
EDIT: I can get JWT including my custom claims and if I decode it I see like this (as you see it doesn't contain permissions):
By looking at the JWT response, I can say you have done either or both of the following.
It seems there is a mistake in the guide of configuring the application-authentication extension.
If you have added,
[authentication.framework.extensions]
claim_handler="com.wso2.sample.claim.handler.CustomClaimHandler"
in to the deployment.toml, but you use the jar by building the code, there is a mismatch in the package name. You have to use the following config.
[authentication.framework.extensions]
claim_handler="org.wso2.custom.claim.PermissionClaimHandler"
Because of this configuration issue, your custom handler may not get executed even though that service got activated properly.
If the claim handler is active and the configuration is correct as step one, you might have missed something when mapping the custom claim to an oidc claim / adding it as an OIDC sope / configuring service provider claims
I created a new service account and I was trying to generate a key for it. I selected "Create Key", chose "JSON", and then this happens:
Download image
The download just doesn't happen (0kb size and host is null), I've tried on different browsers, different computers and I don't know what to do, the problem doesn't seem to be on my side...
What can I do about this?
I just had this same problem.
In order to access the Service Account Key file you need to ensure that you can use your API Key (under your Project Credentials), which may be restricted.
My API Key was restricted to my IP address and to the specific API I wanted to use.
After removing the API restriction only then did the download work (see below).
Hope this helps.
UI showing API restrictions removed
I also had the same problem but got solved by changing my browser.
Since I was working with the brave browser and was unable to download this file.
After that, I changed my browser to chrome. The problem was solved.
SOMETIME BROWSER CAN HAVE SOME ISSUE.
I went through the Pinterest's developer center and also found a thread from 2016 which mentions that getting another Pinterest user's info (pins, follower count, etc.) is not part of the API. Is that correct? Can someone please confirm.
I also found mentions of V3 Pinterest API, but can't find official documentation for it. How can I get access to the V3 API?
I don't see anything about v3 of the API on their documentation.
But as with most APIs like Pinterest's API, you can only get the user information for the currently authenticated user, not just random users. When they log in using OAuth, they will get a prompt for permission like this image:
So, if your user allows your app to have those permissions you should be able to access the user object which includes a counts property. According to the docs, the counts property includes: "The user’s stats, including how many Pins, follows, boards they have".
this shouldn't be this difficult. I assumed it was a permission thing, but then it doesn't make sense when the graph API gives me the information but the FQL doesn't. :S
so I'm just trying to get the stream from my public page:
http://www.facebook.com/207941570907
So I'm using their tool:
https://developers.facebook.com/tools/explorer
And I give the Graph API Explorer every single permission and I run this:
https://graph.facebook.com/207941570907/posts
And that works perfectly.. but I want to use FQL instead. So I figure running the following would be EXACTLY the same, but no data appears?! It WAS working a month ago, but I don't know what they changed.. sigh:
https://graph.facebook.com/fql?q=SELECT post_id, message FROM stream WHERE source_id = 207941570907
Does anyone have a clue what I'm doing wrong?
I was able to get, using the graph API explorer, the posts from pages I admin. I currently have all permissions for the access token I'm using.
Using the Graph API Explorer tool, I'd suggest looking thru the permissions to see which one you are missing. Or start with all permissions and start taking one by one off until it breaks.