Academic Knowledge Cognitive Services Labs API error 500 - microsoft-cognitive

I have obtained API keys for the Cognitive Services Labs by Microsoft here, but when I try using the example provided in the API "Try me" page for the graphSearch method, I get a 500 server error after about 20 seconds. Other API endpoints (interpret, evaluate) seem to be working well. Here's my query (also tried via the "Try me" page):
export SERVER=api.labs.cognitive.microsoft.com
curl "https://${SERVER}/academic/v1.0/graph/search?mode=json" \
-H "Host: ${SERVER}" \
-H 'Content-Type: application/json' \
-H "Ocp-Apim-Subscription-Key: ${API_KEY}" \
--data '{"path":"/paper/AuthorIDs/author","paper":{"type":"Paper","NormalizedTitle":"graph engine","select":["OriginalTitle"]},"author":{"return":{"type":"Author","Name":"bin shao"}}}'
I've written an inquiry via the Cognitive Services UserVoice portal but with no answer so far. The service is not listed in the Azure Status page.
I want to know whether my query or account registration is faulty, or is this a temporary problem. Should be easy to answer.

Related

How do I set my project cloud resource location using the CLI only?

I am running the command 'firebase init storage' and am getting the following error...
Error: Cloud resource location is not set for this project but the operation you are attempting to perform in Cloud Storage requires it.
I am writing a script to initialize my project, so I do not want to have to do things manually in a web console if I don't have to.
How can I set the Cloud resource location for my project using either firebase cli or gcloud tools?
Similar concern "Firebase Project Initialization Error: Cloud resource location is not set for this project".
This might help you:
Go to the Firebase console and open your project
Go to the Storage tab ( Side panel on left )
Click setup storage
Run Firebase init again
You may use the REST API to create a script to initialize your project.
REST API sample curl:
curl --request POST \
'https://firebase.googleapis.com/v1beta1/projects/<"PROJECT-ID">/defaultLocation:finalize' \
--header 'Authorization: Bearer '$(gcloud auth application-default print-access-token) \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"locationId":<"REGION-NAME">}' \
--compressed
Check these documentation for reference:
REST Resource: projects
Method: projects.defaultLocation.finalize
Note: After the default GCP resource location is finalized, or if it was already set, it cannot be changed.
Unfortunately, Firebase CLI and Gcloud tools have not yet been implemented to set the Cloud resource location. However you can file a Feature Requests that you might think is helpful.

API Filter in Visual Studio Code keeps being ignored and requests for everything

I am doing some API integration and im just testing out Celoxis API commands, they use REST API. I have downloaded Visual studio code and installed the rest API add on. Normal cURL commands work etc but the filter request wont:
curl -g -X GET -H 'Content-Type: application/json' -H 'Authorization: bearer YourTokenHere' -G --data-urlencode 'filter={"project.id":"1234"}' 'https://app.celoxis.com/psa/api/v2/tasks'
Any help would be appreciated

How to use PKI Authentication to use the Opensearch Dashboards API?

I am trying to use OpenSearch Dashboards API (Amazon Kibana fork) to add a search index. I am using version 1.0 and have also setup the security plugin. I have no issues using TLS PKI for interacting with OpenSearch (Elasticsearch). However, whenever I try to interact with the OpenSearch Dashboard API with TLS PKI authentication, I get an error. I am able to setup PKI within Dashboards to authenticate to OpenSearch without any issues. Here is effectively the command on the shell using curl, but I am looking to use python when finished:
curl -X POST --cert MYCERT.crt --key MYKEY.key --cacert MY-CA-BUNDLE.crt https://HOSTNAME:5601/api/saved_objects/index-pattern/test-index -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d' { "attributes": { "title": "test-index-*","timeFieldName": "#timestamp" } }'
I get the following JSON message error back:
{"statusCode":401,"error":"Unauthorized","message":"Authentication required"}
If I instead use the API with 'simple' username/password, the same command works:
curl -X POST -u USERNAME:PASSWORD https://HOSTNAME:5601/api/saved_objects/index-pattern/test-index -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d' { "attributes": { "title": "test-index-*","timeFieldName": "#timestamp" } }'
However, I can't seem to find a way to allow my ansible to issue a command to the API using PKI certificates, which I am looking to do so I can disable simple authentication. Does anyone know what setting I am missing or if I am misusing the API? I have studied the plugin documentation, but I can't find any item that I am missing.
Did you try a simple query to Opensearch service like:
curl -XGET -k https://$(hostname):9200/ --key MYKEY.key --cert MYCERT.crt
If this one is not working, probably you need to check the certificates that are configured in opensearch.yml file.

How do I access Firestore using CURL with an API Key and service account token?

I am trying to access my Firestore database using cURL from a terminal session. I have read through the REST API documentation for Firestore and the Authentication documentation for authenticating Oauth and services accounts. I have set up a services accounts and IAM roles in API dashboard. I cannot determine from the documentation what the correct path and syntax and what do use for the API Key and the BEARER token. For example, I am trying to receive a json response for the USER xyz, document field FNAME that is stored in a Firestore DATABASE (note - where do i find the the databaseID?) that is in PROJECT testproject.
Here is the CURL command lists in the documentation -
curl \
'https://firestore.googleapis.com/v1beta1/%5BNAME%5D?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
curl --request POST \
'https://firestore.googleapis.com/v1beta2/%5BNAME%5D:exportDocuments?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{}' \
--compressed
Questions are - what do I use for the [YOUR_API_KEY] ?
What do I use for the [YOUR ACCESS TOKEN] -
I have tried the following from credentials for a Service account that I set up
Service account - Key - 3......................e76
Unique ID - 1............39
for the API KEY and the ACCESS TOKEN and get a 403 error back
I also have a Oauth credentials -
Client ID - 2.....113-95.......cpqrarqb.....qnrpc.apps.googleusercontent.com
Client Secret - L......lq
PATH
https://firestore.googleapis.com/v1/projects/{project_id}/databases/{database_id}/collectionGroups/{collectionId}/fields/{field_id}
Which didn't work either...
Again, I am trying to access and read and write data to my Firestore database using CURL - as a proxy for what will be my REST API's. Any help and assistance much appreciated.
From the curl commands you have pasted I understand that you want to export your firestore collections to a Cloud Storage bucket. Furthermore I understand you obtained the curl commands from the api explorer of the exports method.
To provide an api key value to [YOUR_API_KEY], you first need to create an api key in your GCP project; here is the process:
Go to the credentials section.
Click on the option at the top called 'Create Credentials'.
Select API key.
Copy and keep safe the value thrown by the Cloud Console (this is your api key).
If you want to know more about API keys, you can visit this.
To provide an oauth token value, you can do the following:
You can open Cloud Shell.
Run command gcloud auth application-default print-access-token.
Copy and keep safe the value thrown by Cloud Shell (this is your oauth token).
Please note that there are several ways to create an oauth token but the one I specified is the fastest one. You may also use the oauth playground to generate your token; keep in mind that the token is valid for 60 minutes.
As per the database id I have used (default) and here I include my curl statement:
curl --request POST \
'https://firestore.googleapis.com/v1/projects/[PROJECT_ID]/databases/(default):exportDocuments?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"collectionIds":["users"],"outputUriPrefix":"gs://[BUCKET_PATH]"}' \
--compressed

Linkedin Api sample AdSupplyForecast does not work

Nowadays I am working on Linkedin AdSupplyForecast api to follow at the below reference,
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/advertising-targeting/ad-supply-forecasts#find-supply-by-criteriav2
However the sample code does not work also I can not find any extra description about criteriaV2.
Standart Api sample at the below and response is '{"message":"Invalid HTTP Request","status":404}'
curl -H "Authorization:Bearer XX" -H "Content-Type:application/json" "https://api.linkedin.com/v2/adSupplyForecasts?q=criteriaV2&account=urn%3Ali%3AsponsoredAccount%3A518121035&timeRange=(start: 1587639976000,end: 1589540776000)&campaignType=SPONSORED_UPDATES&competingBid=(bidType:CPM,bidPrice:(currencyCode:USD,amount:10))&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3AcountryGroup%3ANA))))),exclude:(or:(urn%3Ali%3AadTargetingFacet%3AstaffCountRanges:List(urn%3Ali%3AstaffCountRange%3A%2810001%2C2147483647%29))))"
I modified it and like as at the below but it send server error '{"message":"Internal Server Error","status":500}', would you share with me a correct sample of it ?
curl --location --request GET 'https://api.linkedin.com/v2/adSupplyForecasts?q=criteriaV2&account=urn:li:sponsoredAccount:518121035&timeRange.start=1587639976000&timeRange.end=1589540776000&campaignType=SPONSORED_UPDATES&targetingCriteria.include=and:List%28%28or:%28{encoded%20urn:li:adTargetingFacet:locations}:List%28{encoded%20urn:li:countryGroup:NA}%29%29%29%29&targetingCriteria.exclude=or:%28{encoded%20urn:li:adTargetingFacet:staffCountRanges}:List%28{encoded%20urn:li:staffCountRange:%2810001,2147483647%29}%29%29' \ --header 'Authorization: XXX'

Resources