Imgur seems to be letting me search private images, have they screwed up? - imgur

According the imgur website:
When you upload a post to Imgur, you have two post privacy options: Hidden and Public.
A hidden post means that your post is not shared with the general Imgur community and can only be accessed via the URL. Hidden posts cannot be searched,...
Using only my client id (no OAuth), I hit the gallery search endpoint using the tag '#wow' (ie GET https://api.imgur.com/3/gallery/t/wow/). I get the same results as when visiting this publicly accessible page: https://imgur.com/t/wow.
Viewing the metadata for these images that I get from my api request, almost all (56 / 60) have a privacy value of "hidden"
Could be concerning, though wondered if an imgur expert could explain this before I try contact imgur about it.
Portion of the API json response:
{"data":
{"name": "wow",
"display_name": "wow",
"followers": 29719,
"total_items": 17077,
"following": false,
"is_whitelisted": true,
"background_hash": "QL9pTeJ",
"thumbnail_hash": nil,
"accent": "159559",
"background_is_animated": false,
"thumbnail_is_animated": false,
"is_promoted": false,
"description": "",
"logo_hash": nil,
"logo_destination_url": nil,
"description_annotations": {},
"items":
[{"id": "yWPI5rf",
"title": "Lake basement.",
"description": nil,
"datetime": 1656844974,
"cover": "IrUShgg",
"cover_width": 720,
"cover_height": 960,
"account_url": "DacianFalx",
"account_id": 64529075,
"privacy": "hidden", // 56 / 60 items have the same privacy value
"layout": "blog",
"views": 50557,
"link": "https://imgur.com/a/yWPI5rf",
"ups": 481,
"downs": 6,
"points": 475,
"score": 499,
"is_album": true,
"vote": nil,
"favorite": false,
"nsfw": false,
"section": "",
"comment_count": 116,
"favorite_count": 40,
"topic": nil,
"topic_id": nil,
"images_count": 1,
"in_gallery": true,
"is_ad": false,
"tags":
[{"name": "wow",
"display_name": "wow",
"followers": 29719,
"total_items": 17076,
"following": false,
"is_whitelisted": false,
"background_hash": "QL9pTeJ",
...omitted...

Related

Zapier is binding data response from GET request?

I am trying to manipulate a response from GET request, but Zapier is binding all the response data. Please see the image. Is this true, or there are ways around this?
This is the response from Zapier's GET.
Please point me a correct direction.
Here is the raw version:
{
"data": [
{
"id": 19235266,
"text": "Start of chat (WhatsApp)",
"photo": null,
"coordinates": null,
"transport": "whatsapp",
"type": "from_client",
"read": true,
"created": "2018-03-22T08:52:31 UTC",
"audio": null,
"pdf": null,
"remote_id": null,
"recipient_status": null,
"operator_id": 8645,
"channel_id": 1524,
"dialog_id": 903974,
"client_id": 1704911
},
{
"id": 19235267,
"text": "Chat agent – Administrator",
"photo": null,
"coordinates": null,
"transport": "whatsapp",
"type": "system",
"read": true,
"created": "2018-03-22T08:52:31 UTC",
"audio": null,
"pdf": null,
"remote_id": null,
"recipient_status": null,
"operator_id": null,
"channel_id": 1524,
"dialog_id": 903974,
"client_id": 1704911
}
]
}
Thank you in advance.
David here, from the Zapier Platform team.
Luckily, the fix here is very simple. If you want access to the raw hook (instead of the way we process it) you should use the Catch Raw Hook trigger:
Then you'll get your full body as a string:
and you can do whatever you'd like with it. For example, I wrote a small code step to pull the id of the first item:
let j = JSON.parse(inputData.data)
return {emails: j.data}
Which worked as expected. Note that if you return an array from a code step, subsequent steps will happen for each item. Proceed with caution when processing a bunch of items.

Fetching host availability to external webpage in Nagios

Is there any possible way to fetch the live availability of host/host group from Nagios monitoring tool (where host/hostgroups are already configured) which can be redirected/captured to an external webpage.
are there any exposed API's to do that, couldn't found a way.
Nagios is on a Linux host.
Any help or info is appreciated.
EDIT1:
I have a hostgroup say for example 'All_prod' in this hostgroup I will be having around 20 linux hosts for all the host there would be some metrics/checks defined (example availability, cpu load, free memory ..etc). Here I want the report of only availability metrics of all the host(example : lets say if in 24 hours if the availability is down for 10 minutes then it should provide me with the report as it was down for 10 minutes in 24 hours or just give me any related info which i can evaluate using data evaluation).
it would be great if there are any API's to fetch that information, which will return the data as json/xml.
You can use the Nagios JSON API. You can use the query builder here http://NAGIOSURL/jsonquery.html.
But, to answer your specific question, the queries for hosts would look like this:
http://NAGIOSURL/cgi-bin/statusjson.cgi?query=host&hostname=localhost
Which will output something similar to the following:
{
"format_version": 0,
"result": {
"query_time": 1497384499000,
"cgi": "statusjson.cgi",
"user": "nagiosadmin",
"query": "host",
"query_status": "released",
"program_start": 1497368240000,
"last_data_update": 1497384489000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"host": {
"name": "localhost",
"plugin_output": "egsdda",
"long_plugin_output": "",
"perf_data": "",
"status": 8,
"last_update": 1497384489000,
"has_been_checked": true,
"should_be_scheduled": false,
"current_attempt": 10,
"max_attempts": 10,
"last_check": 1496158536000,
"next_check": 0,
"check_options": 0,
"check_type": 1,
"last_state_change": 1496158536000,
"last_hard_state_change": 1496158536000,
"last_hard_state": 1,
"last_time_up": 1496158009000,
"last_time_down": 1496158536000,
"last_time_unreachable": 1480459504000,
"state_type": 1,
"last_notification": 1496158536000,
"next_notification": 1496165736000,
"no_more_notifications": false,
"notifications_enabled": true,
"problem_has_been_acknowledged": false,
"acknowledgement_type": 0,
"current_notification_number": 2,
"accept_passive_checks": true,
"event_handler_enabled": true,
"checks_enabled": false,
"flap_detection_enabled": true,
"is_flapping": false,
"percent_state_change": 0,
"latency": 0.49,
"execution_time": 0,
"scheduled_downtime_depth": 0,
"process_performance_data": true,
"obsess": true
}
}
}
And for hostgroups:
http://NAGIOSURL/nagios/cgi-bin/statusjson.cgi?query=hostlist&hostgroup=linux-servers
Which will output something similar to the following:
{
"format_version": 0,
"result": {
"query_time": 1497384613000,
"cgi": "statusjson.cgi",
"user": "nagiosadmin",
"query": "hostlist",
"query_status": "released",
"program_start": 1497368240000,
"last_data_update": 1497384609000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"hostgroup": "linux-servers"
},
"hostlist": {
"localhost": 8
}
}
}
Hope this helps!
EDIT 1 (To correspond with the question's EDIT 1):
What you're asking for isn't built in by default. You can use the above methods to grab the data for each host (but it sounds like you want it for each service), so again we will use the JSON API found at http://YOURNAGIOSURL/jsonquery.html to grab service data..
http://YOURNAGIOSURL/nagios/cgi-bin/statusjson.cgi?query=service&hostname=localhost&servicedescription=Current+Load
We'll get the following output (something similar, anyway):
{
"format_version": 0,
"result": {
"query_time": 1497875258000,
"cgi": "statusjson.cgi",
"user": "nagiosadmin",
"query": "service",
"query_status": "released",
"program_start": 1497800686000,
"last_data_update": 1497875255000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"service": {
"host_name": "localhost",
"description": "Current Load",
"plugin_output": "OK - load average: 0.00, 0.00, 0.00",
"long_plugin_output": "",
"perf_data": "load1=0.000;5.000;10.000;0; load5=0.000;4.000;6.000;0; load15=0.000;3.000;4.000;0;",
"max_attempts": 4,
"current_attempt": 1,
"status": 2,
"last_update": 1497875255000,
"has_been_checked": true,
"should_be_scheduled": true,
"last_check": 1497875014000,
"check_options": 0,
"check_type": 0,
"checks_enabled": true,
"last_state_change": 1497019191000,
"last_hard_state_change": 1497019191000,
"last_hard_state": 0,
"last_time_ok": 1497875014000,
"last_time_warning": 1497019191000,
"last_time_unknown": 0,
"last_time_critical": 1497018891000,
"state_type": 1,
"last_notification": 0,
"next_notification": 0,
"next_check": 1497875314000,
"no_more_notifications": false,
"notifications_enabled": true,
"problem_has_been_acknowledged": false,
"acknowledgement_type": 0,
"current_notification_number": 0,
"accept_passive_checks": true,
"event_handler_enabled": true,
"flap_detection_enabled": true,
"is_flapping": false,
"percent_state_change": 0,
"latency": 0,
"execution_time": 0,
"scheduled_downtime_depth": 0,
"process_performance_data": true,
"obsess": true
}
}
}
The most important line for what you're trying to do (as far as I understand it) is the perfdata line:
"perf_data": "load1=0.000;5.000;10.000;0; load5=0.000;4.000;6.000;0; load15=0.000;3.000;4.000;0;",
This is the data you'd use to generate whatever custom metrics report you're trying to generate.
Keep in mind this is something that is sort of built in to Nagios XI (not in an exportable format like you're requesting) but the metrics component does allow you to easily drill down and take a look at some metric specific data.
Hope this helps!

Remove properties related to Sharepoint from raw odata response

I am using Sharepoint REST API to get/modify data in Sharepoint from NodeJS.
I am getting odata response from Sharepoint REST API and everything is working as expected.
Except one thing.
Currently I am getting response from Sharepoint REST API as below
{
"odata.metadata": "https://test.sharepoint.com/_api/$metadata#SP.ApiData.Lists",
"value": [
{
"odata.type": "SP.List",
"odata.id": "https://test.sharepoint.com/_api/Web/Lists(guid'sample-guid')",
"odata.etag": "\"6\"",
"odata.editLink": "Web/Lists(guid'sample-guid')",
"AllowContentTypes": true,
"BaseTemplate": 160,
"BaseType": 0,
"ContentTypesEnabled": true,
"CrawlNonDefaultViews": false,
"Created": "2015-05-19T11:13:46Z",
"DefaultContentApprovalWorkflowId": "00000000-0000-0000-0000-000000000000",
"Description": "Use this list to track access requests to a site or uniquely permissioned items in the site.",
"Direction": "none",
"DocumentTemplateUrl": null,
"DraftVersionVisibility": 0,
"EnableAttachments": false,
"EnableFolderCreation": false,
"EnableMinorVersions": false,
"EnableModeration": false,
"EnableVersioning": true,
"EntityTypeName": "AccessRequests",
"FileSavePostProcessingEnabled": false,
"ForceCheckout": false,
"HasExternalDataSource": false,
"Hidden": true,
"Id": "sample-id",
"IrmEnabled": false,
"IrmExpire": false,
"IrmReject": false,
"IsApplicationList": false,
"IsCatalog": false,
"IsPrivate": false,
"ItemCount": 1,
"LastItemDeletedDate": "2015-05-19T11:13:46Z",
"LastItemModifiedDate": "2015-08-04T06:57:22Z",
"ListItemEntityTypeFullName": "SP.Data.AccessRequestsItem",
"MajorVersionLimit": 0,
"MajorWithMinorVersionsLimit": 0,
"MultipleDataList": false,
"NoCrawl": true,
"ParentWebUrl": "/",
"ParserDisabled": false,
"ServerTemplateCanCreateFolders": true,
"TemplateFeatureId: "sample-id",
"Title": "Test Title"
}, {
........
}]
}
In the above response I am getting fields which are related to Sharepoint System along with fields I want.
for ex: odata.type, odata.id, AllowContentTypes, BaseTemplate etc.
How do I get the fields which I required but not the other Sharepoint related fields.
Can anybody help ?
Thanks
For that purpose you could utilize $select query option (follow OData Version 2.0 for a more details).
Regarding odata.type and odata.id properties, since they are part
of metadata properties, you just need to specify the proper Accept
header in order to request them (eg: accept:
application/json;odata=minimalmetadata). For a more details follow JSON
Light support
in REST SharePoint API released article.
The following example returns a specific set of List resource properties such as AllowContentTypes and BaseTemplate:
Endpoint URI: https://contoso.sharepoint.com/_api/web/lists?$select=AllowContentTypes,BaseTemplate
Accept: application/json; odata=minimalmetadata
Method: GET
Result
{
"d": {
"results": [
{
"__metadata": {
"id": "https://contoso.sharepoint.com/_api/Web/Lists(guid'82dcfcc5-e58c-4610-b4c3-589a7228e912')",
"uri": "https://contoso.sharepoint.com/_api/Web/Lists(guid'82dcfcc5-e58c-4610-b4c3-589a7228e912')",
"etag": "\"0\"",
"type": "SP.List"
},
"AllowContentTypes": true,
"BaseTemplate": 125
},
//...
]
}
}

Flickr API Not Returning Actual Photos

Hi i'm on a project and want to use Flickr for my image galery, i'm using the photosets.* method but whenever i make a request i don't get images, i only get info.
Json Result:
{
"photoset": {
"id": "77846574839405047",
"primary": "88575847594",
"owner": "998850450#N03",
"ownername": "mr.barde",
"photo": [
{
"id": "16852316982",
"secret": "857fur848c",
"server": "8568",
"farm": 9,
"title": "wallpaper-lenovo-blue-pc-brand",
"isprimary": "1",
"ispublic": 1,
"isfriend": 0,
"isfamily": 0
},
{
"id": "16665875068",
"secret": "857fur848c",
"server": "7619",
"farm": 8,
"title": "white_horses-1280x720",
"isprimary": "0",
"ispublic": 1,
"isfriend": 0,
"isfamily": 0
}
],
"page": 1,
"per_page": "2",
"perpage": "2",
"pages": 3,
"total": "6",
"title": "My First Album"
},
"stat": "ok"
}
Please would like to have actual image URLs returned, how can i do this.
Thanks to the comment by #CBroe
I found this in the Flickr API doc.
You can construct the source URL to a photo once you know its ID, server ID, farm ID and secret, as returned by many API methods.
https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg
or
https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}_[mstzb].jpg
or
https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{o-secret}_o.(jpg|gif|png)
The final result would then look something like this.
https://farm1.staticflickr.com/2/1418878_1e92283336_m.jpg
Reference: https://www.flickr.com/services/api/misc.urls.html

Is it not possible to get the birthday of a user with JSON WS in Liferay?

I am using Liferay for user management and an external application that communicates with Liferay using JSON Web services. When I call the web service /user/get-user-by-id
{
"agreedToTermsOfUse": false,
"comments": "",
"companyId": 10153,
"contactId": 16003,
"createDate": 1390552990000,
"defaultUser": false,
"emailAddress": "basketball#liferay.com",
"emailAddressVerified": false,
"facebookId": 0,
"failedLoginAttempts": 0,
"firstName": "Basketball1",
"graceLoginCount": 0,
"greeting": "Welcome Basketball1!",
"jobTitle": "",
"languageId": "en_US",
"lastFailedLoginDate": null,
"lastLoginDate": null,
"lastLoginIP": "",
"lastName": "",
"ldapServerId": -1,
"lockout": false,
"lockoutDate": null,
"loginDate": null,
"loginIP": "",
"middleName": "",
"modifiedDate": 1390992862465,
"openId": "",
"portraitId": 18708,
"reminderQueryAnswer": "",
"reminderQueryQuestion": "",
"screenName": "basketball1",
"status": 0,
"timeZoneId": "Europe/Paris",
"userId": 16002,
"uuid": "3ce789e0-4cb5-45bf-b57e-68c44ea3ec04"
}
And some information as birthday is missed. I see that also I can change the birthday using the web services /user/update-user but I cannot retrieve the original value. How can I get the birthday information? Is there any other method to obtain the missing data?
And... if I want to update any field of the user and in /user/update-user I MUST put the birthday and I cannot retrieve the old value... the birthday will be lost!
You can get the user birthday through contact service:
http://localhost:8080/api/jsonws/contact/get-contact/contact-id/10202
where id is the user-id

Resources