how to get all bucket types in riak using http get - riak

I know how to list all bucket types using command line .reference http://stackoverflow.com/questions/30785431/how-to-list-all-the-bucket-types-in-riak
But I need it using HTTP call

There is currently no way to list bucket types via HTTP. I can suggest two options:
Wrap the riak-admin bucket-types list command in a simple Web service and expose it via HTTP.
Install the experimental Riak Explorer, point it to your cluster, and use the bucket_types endpoint to list bucket types. For example, curl -X GET http://127.0.0.1:9000/explore/clusters/default/bucket_types should give you something like
{
"bucket_types": [{
"id": "default",
"props": {
"active": true,
"allow_mult": true,
"basic_quorum": false,
"big_vclock": 50,
"chash_keyfun": "{riak_core_util,chash_std_keyfun}",
"dvv_enabled": false,
"dw": "quorum",
"last_write_wins": false,
"linkfun": "{modfun,riak_kv_wm_link_walker,mapreduce_linkfun}",
"n_val": 3,
"notfound_ok": true,
"old_vclock": 86400,
"postcommit": [],
"pr": 0,
"precommit": [],
"pw": 0,
"r": "quorum",
"rw": "quorum",
"small_vclock": 50,
"w": "quorum",
"write_once": false,
"young_vclock": 20
}
}],
"links": {
"self": "/explore/clusters/default/bucket_types"
}
}

Related

Airflow ECS Register Task Operator, error when passing env. variables

when I am trying to pass env. variables to my ECSRegisterTaskOperator, I get the following error:
Unknown parameter in input: "environment", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode
However according to the documentation for boto3 with Ecs, one has to pass env variables via the environment dictionary.
[reference: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.register_task_definition ]
The part of my task looks like this:
register_task_kwargs={
"cpu": "256",
"memory": "512",
"networkMode": "awsvpc",
"environment": [
{
"name": "REDSHIFT_HOST",
"value": redshift_cluster_test_connection.host
},
{
"name": "REDSHIFT_USER",
"value": "redshift_cluster_test_connection.user"
},
{ "name": "REDSHIFT_PW",
"value": redshift_cluster_test_connection.password}
]
The environment settings go inside the containerDefinitions. You have them at the top level, instead of inside the containerDefinitions.

Does SmartSheet support any CURL to get the total row count in a sheet?

I am using curl with REST to access Smartshets in my C# running on WIN CE. My application is supposed to dump some data on smartsheet periodically.
Before I write to a sheet, I would like to know the total row count in the sheet so that I don't exceed 5000 rows per sheet.
I am looking for an API that would return just row count given the sheet id?
Currently using below API which returns the entire sheet data and takes very long to fetch and format.
curl https://api.smartsheet.com/2.0/sheets/{sheetId}
with data of upto 5000 rows pr sheet, it takes very long to fetch and format below response to determine the available rows:
{
"id": 4583173393803140,
"name": "sheet 1",
"version": 6,
"totalRowCount": 240,
"accessLevel": "OWNER",
"effectiveAttachmentOptions": [
"EVERNOTE",
"GOOGLE_DRIVE",
"EGNYTE",
"FILE",
"ONEDRIVE",
"DROPBOX",
"BOX_COM"
],
"readOnly": true,
"ganttEnabled": true,
"dependenciesEnabled": true,
"resourceManagementEnabled": true,
"cellImageUploadEnabled": true,
"userSettings": {
"criticalPathEnabled": false,
"displaySummaryTasks": true
},
"userPermissions": {
"summaryPermissions": "ADMIN"
},
"workspace": {
"id": 825898975642500,
"name": "New Workspace"
},
"projectSettings": {
"workingDays": [
"MONDAY",
"TUESDAY",
"WEDNESDAY"
],
"nonWorkingDays": [],
"lengthOfDay": 8
},
"hasSummaryFields": false,
"permalink": "https://app.smartsheet.com/b/home?lx=pWNSDH9itjBXxBzFmyf-5w",
"createdAt": "2018-09-24T20:27:57Z",
"modifiedAt": "2018-09-26T20:45:08Z",
"columns": [
{
"id": 4583173393803140,
"version": 0,
"index": 0,
"primary": true,
"title": "Primary Column",
"type": "TEXT_NUMBER",
"validation": false
},
{
"id": 2331373580117892,
"version": 0,
"index": 1,
"options": [
"new",
"in progress",
"completed"
],
"title": "status",
"type": "PICKLIST",
"validation": true
}
],
"rows": Array[4962]....
}
Any help will b greatly appreciated.enter code here
There isn't a request to specifically return the number of rows on a Sheet. But, with any GET /sheets/{sheetId} operation the resulting Sheet object returned will have a top level totalRowCount attribute on it. So, you don't have to GET the sheet and count the objects in the rows array. Instead you can look to the totalRowCount attribute and the value there to know how many rows are currently on the sheet.
If you are concerned about pulling down all of the Sheet data you can use paging to keep from getting all of the data returned. Doing a GET /sheets/{sheetId}?pageSize=1 will give you the Sheet object with only the first row of data to help make the payload smaller. The totalRowCount attribute will still be present in the response.

Missing likes/comments in LinkedIn API response

since 4 days my job which is fetching linkedIn updates is getting null responses for likes and comments (requests on specific updates : /updates/key={update-key}/likes and /updates/key={update-key}/update-comments endpoints). This is probably expected since when requesting on /updates/key={update-key}, the response does not have likes nor comments field.
My question is how can I get those values for specific updates (which I managed to get previously) since I can get them differently (maybe? read following)
Here's the strangest part : when I don't specify the update (request only on /updates endpoint), I get the following response : (modified a bit for readability/privacy)
{
"_count": 10,
"_start": 0,
"_total": 212,
"values": [
{
"isCommentable": false,
"isLikable": false,
"isLiked": false,
"likes": {
"_total": 3,
"values": [...]
},
"numLikes": 7,
"timestamp": ...,
"updateComments": {"_total": 0},
"updateContent": {...},
"updateKey": ...
"updateType": ...
},{
"isCommentable": false,
"isLikable": false,
"isLiked": false,
"likes": {
"_total": 3,
"values": [...]
},
"numLikes": 9,
"timestamp": ...,
"updateComments": {"_total": 0},
"updateContent": {...},
"updateKey": "...",
"updateType": "..."
}, ....
So first, the updates have their fields isCommentable, isLikable and isLiked set to false, despite the fact that they have likes/comments.
Second, there is an inconsistency between the fields likes._total and numLikes (the latter one is the correct amount of likes)
Does anyone else encountered a similar problem? (well linkedin api update comment count null) Is it something expected or a change from LinkedIn side?
I already ask to LinkedIn help center which redirected me to StackOverflow.
Thanks for your time.
Ok, I retried today :
{
"isCommentable": true,
"isLikable": true,
"isLiked": false,
"likes": {
"_total": 9,
"values": [
{ ...
So definitely an issues on linkedin side, fixed for now.
Same issue.
If you get a specific company update (with comment and like)
//api.linkedin.com/v1/companies/xxxx/updates/key=yyyy?format=json
{
"isCommentable": false,
"isLikable": false,
...
}
If you get comments for a specific company update
//api.linkedin.com/v1/companies/xxxx/updates/key=yyyy/likes?format=json
Result null
If you get likes for a specific company update
//api.linkedin.com/v1/companies/xxxx/updates/key=yyyy/update-comments?format=json
Result null

How to use a HTTP HEAD request as health check for Marathon?

Look like the protocols HTTP or MESOS_HTTP only do GET request.
This works:
"healthChecks": [
{
"protocol": "COMMAND",
"command": "curl -I http://0.0.0.0:5000/",
"gracePeriodSeconds": 300,
"intervalSeconds": 60,
"timeoutSeconds": 20,
"maxConsecutiveFailures": 3
}
],
But I found it to much for such simple tasks... I would expect something simpler, something like "method":"HEAD":
"healthChecks": [
{
"protocol": "HTTP",
"path": "/",
"portIndex": 5000,
"method": "HEAD",
"gracePeriodSeconds": 300,
"intervalSeconds": 60,
"timeoutSeconds": 20,
"maxConsecutiveFailures": 3
}
],
If you need/want HTTP HEAD based health checks then COMMAND-based are your only option. The HTTP-based support GET only. See also the Marathon docs for more details.

Alfresco REST API: How do I list folders in the site?

Given this URL
http://localhost:8080/alfresco/service/api/sites/test-3
I get back:
{
"url": "\/alfresco\/service\/api\/sites\/test-3",
"sitePreset": "site-dashboard",
"shortName": "test-3",
"title": "Test 3",
"description": "",
"node": "\/alfresco\/service\/api\/node\/workspace\/SpacesStore\/0352afea-797f-4b9e-be27-3bf37e54a2f1",
"tagScope": "\/alfresco\/service\/api\/tagscopes\/workspace\/SpacesStore\/0352afea-797f-4b9e-be27-3bf37e54a2f1",
"siteManagers":
[
"admin"
],
"isPublic": true,
"visibility": "PUBLIC"
}
How to I use that info to get the list of folders in the site?
You need to use a different API. Look at this shell session:
$ curl -u admin:admin -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d "{'shortName':{'values':['test'], 'match':'foo'}}" http://localhost:8080/alfresco/service/api/sites/query
{
"url" : "\/alfresco\/service\/api\/sites\/test",
"sitePreset" : "wcmqs-site-dashboard",
"shortName" : "test",
"title" : "test",
"description" : "",
"node" : "\/alfresco\/service\/api\/node\/workspace\/SpacesStore\/e597e4c2-d307-46e3-ba4d-b911262e7261",
"tagScope" : "\/alfresco\/service\/api\/tagscopes\/workspace\/SpacesStore\/e597e4c2-d307-46e3-ba4d-b911262e7261",
"isPublic" : false,
"visibility" : "PRIVATE",
"siteManagers" :
[
"admin"
]
}
// see the 'node' property up there
$ curl -u admin:admin http://p01:8080/alfresco/service/api/node/workspace/SpacesStore/e597e4c2-d307-46e3-ba4d-b911262e7261/children
[..cmis response here..]
One option is to use CMIS. Depending on your exact needs though, you can use some built in webscripts to do the listings too
Within the root of a site, you have Containers, such as documentLibrary and wiki. You can get a list of the containers for a site from the container.get webscript. Take a look at org/alfresco/slingshot/documentlibrary/container.get.desc.xml for the details. The URL pattern for it, as shown in that file, is /slingshot/doclib/containers/{site}
curl -u admin:admin http://localhost:8080/alfresco/service/slingshot/doclib/containers/test
{
"containers":
[
{
"name": "documentLibrary",
"description": "Document Library",
"nodeRef": "workspace://SpacesStore/973338a0-db39-458e-a10d-396f00cb16a3",
"type": "cm:folder"
}
]
}
Next, when you know what container or folder within a container you want to use, the treenode.get webscript can let you list that, eg
curl -u admin:admin http://localhost:8080/alfresco/service/slingshot/doclib/treenode/site/test/documentLibary
{
"totalResults": 0,
"resultsTrimmed": false,
"parent":
{
"nodeRef": "workspace://SpacesStore/92e4f8de-b919-4540-a27a-16c4e53a57bc",
"userAccess":
{
"create": true,
"edit": true,
"delete": true
}
},
"items":
[
]
}
I can also recommend you use http://localhost:8080/alfresco/service/index to view what webscripts are present in your system, and get information on them, it helps a lot for situations like this
Load a site: http://localhost:8080/alfresco/service/api/sites/test-3
{
"url": "\/alfresco\/service\/api\/sites\/test-3",
"sitePreset": "site-dashboard",
"shortName": "test-3",
"title": "test 3",
"description": "",
"node": "\/alfresco\/service\/api\/node\/workspace\/SpacesStore\/0352afea-797f-4b9e-be27-3bf37e54a2f1",
"tagScope": "\/alfresco\/service\/api\/tagscopes\/workspace\/SpacesStore\/0352afea-797f-4b9e-be27-3bf37e54a2f1",
"siteManagers":
[
"admin"
],
"isPublic": true,
"visibility": "PUBLIC"
}
Get the site contents using the ID extracted from the node property: http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/0352afea-797f-4b9e-be27-3bf37e54a2f1/children
Inside that is a node with the title "documentLibrary". Using its ID GUID, you can fetch some more children
http://localhost:8080/alfresco/service/cmis/s/workspace:SpacesStore/i/b68db1eb-547d-4b2c-b5eb-ba207a275789/children
If you have custom properties, they will appear on the child items using this API call.
Using the ID of the child item, you can get its content.
http://localhost:8080/alfresco/service/cmis/s/workspace:SpacesStore/i/2d53f464-bea0-46f3-aa0c-10b3302e661c/content
Use this url to get folder list.
http://localhost:8080/alfresco/service/api/node/workspace:SpacesStore/store_id/b0697dd1-ae94-4bf6-81c8-5e2fa098ddfa/children

Resources