How can I fetch all job openings data by using zoho recruiter API? - zoho

I want to fetch all the jobs that I posted on my Zoho recruit. And I want to fetch all those jobs on my website for that I use the below API.
curl "https://recruit.zoho.com/recruit/v2/jobopening"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Scope:
scope=ZohoRECRUIT.modules.jobopening.READ
I use all the necessary parameters but still it give the error like
{
"code": "INTERNAL_ERROR",
"details": {},
"message": "EXTRA_PARAM_FOUND",
"status": "error"
}

Related

laptop curl Youtube API v3 request always returns 'Exceeded Quota' error

Every time I attempt to use the following simple bash script command on my Macbook Pro laptop, I get an 'Exceeded Quota' error. I do supply a valid API key and I'm under the impression that I don't need any other tokens because I am only requesting Public information (a simple list of songs).
Bash script:
#!/bin/bash
curl \
'https://youtube.googleapis.com/youtube/v3/search?part=snippet&q=music&type=video&key=[My API key]' \
--header 'Accept: application/json' \
--compressed
Reply:
{
"error": {
"code": 403,
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
"errors": [
{
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
"domain": "youtube.quota",
"reason": "quotaExceeded"
}
]
}
}
I don't have any quota problems pulling song lists via the YouTube Data API 'list' page:
https://developers.google.com/youtube/v3/docs/search/list

Model is not deployed and cannot predit

On Google Cloud Automl - Language Classification, I put in the following request for prediction.
I am getting - The model is not deployed, hence not supported for prediction yet.
How do we deploy a model ? I do not see any documentation if deploying a model
I am running this command shown in code in Google Cloud Shell
curl -X POST -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" -H "Content-Type: application/json" https://automl.googleapis.com/v1beta1/projects/[projectid]/locations/us-central1/models/[Modelname]:predict -d '{
"payload" : {
"textSnippet": {
"content": "YOUR TEXT HERE",
"mime_type": "text/plain"
},
}
}'
{
"error": {
"code": 400,
"message": "The model is not deployed, hence not supported for prediction yet.",
"status": "FAILED_PRECONDITION"
}
}
Expected prediction
You can deploy a successfully trained model using the UI on GCP.
Under HOME go to your respective AI and find your model in its dashboard.

how to get list of flowfile from queue in nifi connection?

I want to get each flowfile from queue in connection when the flow was blocked with NiFi REST API.
I find that the functions of /nifi-api/flowfile-queues/{id}/listing-requests can meet my needs.And it response a ListingRequestDTO:
enter image description here
The field named flowFileSummaries can return a array of flowFile.And then I can get each uuid from flowfiles:
{
"uri": "value",
"uuid": "value",
"filename": "value",
"position": 0,
"size": 0,
"queuedDuration": 0,
"lineageDuration": 0,
"clusterNodeId": "value",
"clusterNodeAddress": "value",
"penalized": true
}
BUT,when I use the API and can not find the "FlowFileSummary"
{
"listingRequest": {
"id": "0165122a-e1ac-134e-2c09-92ba9ca93e8b",
"uri": "http://.../nifi-api/flowfile-queues/07a23828-d6f3-1e00-27af-f0428a493507/listing-requests/0165122a-e1ac-134e-2c09-92ba9ca93e8b",
"submissionTime": "09/07/2018 18:46:57.496 CST",
"lastUpdated": "18:46:57 CST",
"percentCompleted": 0,
"finished": false,
"maxResults": 100,
"state": "Waiting for other queue requests to complete",
"queueSize": {
"byteCount": 370689,
"objectCount": 995
},
"sourceRunning": false,
"destinationRunning": false
}
}
So, is there any possible solution to achieve? or any other solution? Thanks!
I don't believe the flow file summaries are available until the listing request is complete. In your example response above, note that finished is false. You can keep querying the API for that listing request until finished is true, then the summaries should be available. Then you can use the /flowfile-queues/{id}/flowfiles/{flowfile-uuid} and /flowfile-queues/{id}/flowfiles/{flowfile-uuid}/content endpoints to get the attributes and content of each flow file.
You do not need to have the listing request to complete. Here are the steps I used successfully to get the contents of flow file
Get the id of the Queue from NiFi UI console
Replace id here : curl -X POST https://myhost:443/nifi-api/flowfile-queues/{id}/listing-requests -H 'Authorization: Bearer ' --compressed --insecure
To get uris of flowfiles in the queue, get the value of 'uri' field from the response of the command in step2 and use it in next curl command, for ex:
For ex: curl -X GET https://myhost:443/nifi-api/flowfile-queues/0f66c88c-225d-3229-b2e1-597d8fba2c09/listing-requests/13802f9c-016a-1000-0000-00004eb033fb -H 'Authorization: Bearer ' --compressed --insecure
To get flow file content, get the value of 'uri' field from the response of the command in step3 and and use it in next curl command, for ex:
curl -X GET https://myhost:443/nifi-api/flowfile-queues/0f66c88c-225d-3229-b2e1-597d8fba2c09/flowfiles/7ccf5c54-7c8d-448a-a124-7f75f5845ec1?clusterNodeId=35a3df65-d7bf-47d2-b162-ea15c3c02c30 -H 'Authorization: ' --compressed --insecure
Note: if there are multiple flow files, you will see see multiple URIs in the response of step 3 curl command

Last Login Date to Application

I am looking for an API to find the user's last login date to a particular application. Not sure if it exists, please let me know your thoughts on getting this information through API calls.
You can get the last date the user was authenticated to any application on the User profile:
GET https://dev-12345.oktapreview.com/api/v1/users/xyz
{
"id": "xyz",
"status": "ACTIVE",
"created": "2017-02-22T02:33:02.000Z",
"activated": null,
"statusChanged": "2017-02-22T17:50:43.000Z",
"lastLogin": "2017-09-28T16:19:57.000Z",
"lastUpdated": "2017-08-08T20:11:46.000Z",
"passwordChanged": "2017-02-22T17:50:43.000Z",
"profile": {
"lastName": "Barbettini",
"firstName": "Nathanael",
// ...
}
The lastLogin field contains the timestamp of the last time the user logged in.
This isn't tracked on a per-app basis, though. You can get the app-specific App User:
GET https://dev-12345.oktapreview.com/api/v1/apps/abc/users/
{
"created": "2017-09-22T00:54:49.000Z",
"lastUpdated": "2017-09-22T00:54:49.000Z",
"scope": "GROUP",
"status": "ACTIVE",
"statusChanged": "2017-09-22T00:54:49.000Z",
"passwordChanged": null,
"syncState": "DISABLED",
"profile": {
"zoneinfo": "America/Los_Angeles",
"region": null,
// ...
}
But it doesn't have lastLogin. One way you could solve this is by saving a timestamp in the App User profile in your application code.
You could use filters to specify which logs do you want from the system logs API endpoint, limit the answer to 1, set the response order to start from the most recent ones, and user filters again to filter for your user.
So, you need to filter the request using the following filters:
actor.alternateId: which identifies the user, in my case the pattern "username#" is enough
event_type: this one should be user.authentication.sso which means that the user SSO to an app (any of the ones available for that user)
outcome.result: success, which means that the user successfully SSO to the app
Example query would be something like this:
curl -X GET -H "Content-Type: application/json" -H "Authorization: SSWS super-secret-token-here" -H "Accept: application/json" "https://<your.domain.here.com>/api/v1/logs?until=2018-07-17T11%3A30%3A55.664541&limit=1&sortOrder=DESCENDING&filter=event_type+eq+%22user.authentication.sso%22+and+outcome.result+eq+%22SUCCESS%22+and+actor.alternateId+sw+%22<user name here>%40%22"
Remember to replace the token, the URL and the before testing this query.
Also, remember that this example is URL encoded, so this is why it looks so weird.

googleapis giving back bad request

Having implemented oauth2.0 and done a handshake using the scopes:
"https://www.googleapis.com/auth/userinfo.email ",
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/admin.directory.user ",
"https://www.googleapis.com/auth/admin.directory.group ",
"https://www.googleapis.com/auth/admin.directory.orgunit ",
I get back a token
the request
$ curl -X GET https://www.googleapis.com/oauth2/v1/userinfo?access_token=<Token>
{
"id": "{id}",
"email": "{email}",
"verified_email": true,
"name": "{name}",
...
}
as it should.
however a requst to the admin.directory.user namespace does not succeed:
$ curl -X GET https://www.googleapis.com/admin/directory/v1/users?access_token=<Token>
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
Any good ideas to why this is?
The request to admin.directory.users is constructed from https://developers.google.com/admin-sdk/directory/v1/reference/#Users
I had the same problem retrieving all users through https://www.googleapis.com/auth/admin.directory.user endpoint. According to the documentation, you could do that in a specific domain by passing the domain as a parameter or get all existing users by passing the customer=my_customer parameter as follows:
Retrieve all users in a domain doc: https://www.googleapis.com/auth/admin.directory.user?domain=example.com
or
Retrieve all account users doc: https://www.googleapis.com/auth/admin.directory.user?customer=my_customer
In google playground oauth2 also you can test the above stuff by selecting Admin SDK API directory_v1 and auth/admin.directory.user.readonly to authorize the respective scope, then call the above requests.
Note that, you may need to get access to google playground within your google admin dashboard under the security apps section.
You need to specify either the domain (to get fields from only one domain) or the customer (to return all domains for a customer account).
I filed a bug to make more clear that is required to provide one of the two parameters.
At the very least, you need to include the Content-Type header:
curl -X GET -H "Content-Type: application/json" https://www.googleapis.com/admin/directory/v1/users?customer=my_customer&access_token=<Token>
For a full script that implements this API with CURL and BASH see this answer.
Note that the documentation is currently incorrect because it lists customer as an optional parameter when it is in fact required.

Resources