In Sumo Logic, how do I get a list of folders off the root folder? - sumologic

Using the Sumo Logic API, /api/v2/content/folders/{id} works and gives me the parentId. hitting the same endpoint for a folder off the root folder gives a parentId. however hitting the same endpoint with that id errors with "Content with the given ID does not exist."
When I hit /api/v2/folders/global it returns an id. every time I hit the endpoint it gives me a different id. trying to use any of those ids at /api/v2/content/folders/{id} also gives the error "Content with the given ID does not exist."
I'm trying to write a script that will return the Sumo Logic ID of a folder from a user-defined path. e.g. get_sumo_id -p "/products/someapp/monitoring"

Figured it out. I hadn’t read the docs well enough. The id returned from /api/v2/folders/global is a job id, not a folder id. You wait until it's done and check for success using /api/v2/folders/global/<job id>/status. if successful you can retrieve /api/v2/folders/global/<job id>/result.

Related

Microsoft graph API: /me/drive/root/search - no path to found file

I have problem with graph API. I'm making search component in React. Of course there can be many files with same name so I need to display path to it also. Problem is with this endpoint:
https://graph.microsoft.com/v1.0/me/drive/root/search(q='book')
I noticed that when I'm searching for all drive elements I receive path to file. But when I'm using /me/drive endpoint to search for only my files there is no path in parentReference.
The only option to get path is making second request:
https://graph.microsoft.com/v1.0/me/drive/items/{parent_reference_id}
Is there any solution for this? I tried expanding parentReference but it's saying that it's not supported.
When ever you try to get the path of an item you can use the /Items/{itemId} endpoint that gives the ParentReference property with the path in it.
https://graph.microsoft.com/v1.0/me/drive/Items/{Itemid}
In your case as you are searching for book file, pull the id from there and use the above query to get the path.

OneM2M, IOTKETI Mobius RETRIEVE Group Member ContentInstances

In my example architecture; I have an IN-Mobius and a ADN-AE-Thyme (nCube Thyme).
First of all; i created a AE which is called "ae_test_02", i can GET this resource via Postman.
After this step; i run ADN-AE-Thyme, thyme.js, and it created a container which is called "thyme_01", and also i can GET this resource via Postman.
Also in that step, thyme.js add containerInstances into the "thyme_01" container. Then, i can get that latest containerInstance with "/la" parameter via Postman
In this point, the problem has began. I create a group resource, while creating i tried couple solutions, always fail. I tried in "mid" attribute;
{ "m2m:grp": {
"rn": "grp_test_100520_08",
"mt": 3,
"mid": ["3-20200505012920476/la",
"Mobius/3-20200505012920476/la",
"Mobius/thyme_01/la",
"Mobius/ae_test_02/3-20200505012920476/la",
"Mobius/ae_test_02/thyme_01/la",
"ae_test_02/thyme_01/la",
"ae_test_02/3-20200505012920476/la"],
"mnm": 10
}
The problem is that, i tried these mid paths one by one, but never works. When i try to get latest containerInstances via Postman, i use this URL and the results is "resource does not exist (get_target_url)"
The containers and contentInstances in the IN-Mobius, and i requested to the IN-Mobius. By using these informations how should i implement group "mid" attribute; for the get containerInstances via group resources ?
First Edit.
Hi Andreas.
For the first issue, i can get resource correctly. In this point my aim is GET containerInstance in the container, which is a member (mid) in that .
Second; now I understand, there is not existing resource in resource, okay. As you mentined, i want to pass a request to all member (containers) of a resource. For this purpose, i will use https://localhost:7579/Mobius/grp_test_100520_08/fopt, but it gives an error "ERR_INVALID_ARG_TYPE". I know that, at least one mid structure is correct, but which one is the correct ?
For the smaller issue, i already know that resouce multiple times in the mid attribute, because i did not know which one is the correct adressing scheme ?
Also, while creating a resource, the resource should be in the ae resource (/Mobius/ae_test_02/grp_name) or in the Mobius (/Mobius/grp_name)
resources can be in directly in IN-Mobius or should in MN-Rosemary? Is fanOutPoint only using by external resource like MN or even IN, fopt using ?
Second Edit.
The "thyme" comes from nCube Thyme (https://github.com/IoTKETI/nCube-Thyme-Nodejs), it creates a container and then randomly create ContainerInstances.
The resource tree looks like;
Mobius >> ae_test_02 (AE resource) >> thyme_01 (Container It created from nCube Thyme https://github.com/IoTKETI/nCube-Thyme-Nodejs) >> ContainerInstances
I have also a resource in >> Mobius >> grp_test_100520_08 (GROUP resource which is uses)
I tried;
{ "m2m:grp": {
"mid": ["Mobius/ae_test_02/thyme_01"],
"mnm": 5
}
}
In this request, fopt.js gives an error "callback is not a function".
{ "m2m:grp": {
"mid": ["ae_test_02/thyme_01"],
"mnm": 5
}
}
In this request, fopt.js gives same "callback is not a function", but in different line.
I guess my fopt.js file is old, then i checked mobius github page and get that file, however it not solve this.
Also my resource look like this;
Also my fopt.js file is same as this;
https://github.com/IoTKETI/Mobius/blob/master/mobius/fopt.js
UPDATE 3.
The "cnm" attribute problem is this; while creating a resouce, CSE will automaticly assign "cnm" attribute according to member size. However, CSE will not this process in UPDATE (PUT) request. From this point, i will create resources, not UPDATE them.
As you mentioned, i send requests to the group's resource, but it gives the "callback is not a function" error. To solve this problem, i downloaded and installed the whole distribution. (https://github.com/IoTKETI/Mobius) After that, i will do same processes again for understand the fopt.js file behaviour. The result wasn't changed, it gives the same error.
I planning to explain whole situation and create an issue, in Mobius github page. I hope they will response soon.
I think there are two issues with your example.
The first issue is with the request to the <Group>. You need to distinguish between requests to the <Group> resource itself and requests to the members of the <Grou>.
There is no child resource <la> of the <Group> resource itself. This is why you receive an error message. If you want to pass a request to all members of a <Group> resource then you need to target the virtual child resource <fopt>. In your case the request should target URI https://localhost:7579/Mobius/grp_text_100520/fopt. Since you already have the <la> resources as members you won't need to add the /la part to the request. However, I would recommend to only add the <Container> resources to the group and use the target URI https://localhost:7579/Mobius/grp_text_100520/fopt/la to retrieve the latest <ContentInstances> of each container.
The second (smaller) issue is that from what I can get from your example code that you add the same resource multiple times to the group, but only with different addressing schemes. Please be aware that the CSE must removes duplicate resources when creating or updating the mid attribute.
Edit after question update
It is not very clear what your resource tree looks like. So, perhaps you should start with only one resource references and continue from there. Valid ID's in the mid attribute are either structured (basically the path of the rn attributes) or unstructured ID's (the ri's). The CSE should filter the incorrect ID, so you should get the correct set of ID's in the result body of the CREATE request.
btw, where does "thyme" come from? This is only in a label, which does not form an ID.
Regarding the <fanOutPoint> resource: Normally all request would be targeted to the <Group> resource, but requests to the virtual <fanOuPoint> resource are forwarded to al the members of the group. If a resource referenced in mid is accessible then the request is forwarded and the result is collected and is part of the result body of the original request.
You also need to be careful and regard the resource types: only send valid requests to the group's members.
Update 2
From the IDs in the mid attribute of the <Group> resource it looks like that the CSE validated the targets (though the cnm (current number of members) is obviously wrong, which seems to be an error of the CSE).
So, you should be able to send requests to the group's <fopt> resource as discussed above.
For the CSE runtime error you should perhaps contact the Mobius developers. But my guess is that you perhaps should download and install the whole distribution, not only a single file.
for anyone in the future; who is dealing with this problem.
The problem is simply is that; in the app.js there is 4 function call (fopt.check). While calling the function in the app.js file, there are 5 parameter exists, on the other hand, while getting these arguments in the function it takes only 4 arguments. For this reason, body_obj always becomes "undefined" then it will never reach the "Container" or "ContainerInstance" source. Lately, KETI was sent a new commit to the Mobius Github page (https://github.com/IoTKETI/Mobius/commit/950182b725d5ffc0552119c5c705062958db285f) to solve this problem. It solves this problem unless you are using use_secure == 'disable'. If you try to use use_secure == 'enable' you should add an if statement to check use_secure and add import HTTPS module.
Also, while creating resource, defining the "mid" attribute is not very clear. Just for now, if you want to reach (latest) source; you should add "/la" for all members of the group. This is recommended by KETI on Github page issue 5.
(https://github.com/IoTKETI/Mobius/issues/5#issuecomment-625076540)
And lastly, thank you Andreas Kraft; your help was very useful.

How do you get available Iteration Paths from Azure DevOps Services REST API?

I cannot find how to retrieve the iterations Paths from the API. I was able to get the parent paths but not child paths.
Tried with below Get command. It is giving just parent iterations but not a child.
GET https://dev.azure.com/{organization}/{project}/_apis/wit/classificationnodes?$depth={$depth}&api-version=5.0
I'm using powershell.
If you're trying to get child paths, try using:
GET https://dev.azure.com/{organization}/{project}/{team}/_apis/work/teamsettings/iterations?api-version=5.1
{team} is not required. You can check this document for more details.
More details:
1.Assuming I have such Iterations:
2.Use this Get request in postman to test:
https://dev.azure.com/MyOrgName/MyProjectName/_apis/work/teamsettings/iterations?api-version=5.1
3.The response will list all child Iterations like this:
A bit late, but the issue is likely that the url contains a $ which needs to be escaped with a ` in powersell so it doesn't get interpreted as the start of a variable name.

Mircrosoft Graph API: List all DriveItems in a drive : badRequest

I am getting the drive of my sharepoint using the following which returns the drive and its ID etc
GET https://graph.microsoft.com/v1.0/sites/mycompany.sharepoint.com:/sites/mysite:/drive
However the below call returns a "Bad Request, url specified is invalid". Has anyone got any ideas on what I am doing wrong?
GET https://graph.microsoft.com/v1.0/sites/mycompany.sharepoint.com:/sites/mysite:/drive/items
You can get the root folders like this
GET https://graph.microsoft.com/v1.0/sites/mycompany.sharepoint.com/sites/mysite/drive/root/children
Note that mysite/drive is the default drive.
You can use
GET https://graph.microsoft.com/v1.0/sites/mycompany.sharepoint.com/sites/mysite/drives/{driveId}/root/children
to identify the specific driveId.
There's no endpoint to get all items in a drive with every file from every subfolder at once.
Here is a similar question for your reference.

Deleting a sub organization

I am running into an issue when I try to delete sub organizations.
I get the following error (customer ID was removed)
Execution of request failed: https://apps-apis.google.com/a/feeds/orgunit/2.0/CustId/QA%2ftesting%2fmoar%2bgroups"}
I am using the Google Apps C# Library and calling it like this
OrgService.DeleteOrganizationUnit(customerID, "QA/testing/moar+groups");
The response body is "1301: Entity Does not exist"
I am taking the path directly from the feed to get all the organizations and passing it into delete and it is still failing... any idea what is going on here?
Is the name of the OU "QA/testing/moar+groups" or is it "QA/testing/moar groups"? You should be passing the true name of the OU to the library, it should take care of URL encoding it.

Resources