Can you get tag of a folder with box API? - box-api

Box allows you to create a tag for your folder, but how do you get that info out of the API? I don't see tag returning in the GET /folders/{id} API. Tag is not considered as a metadata either.

If you take a look at the Fields write up in the documentation it mentions that some fields are not returned by default. Within the docs they are listed in italics in objects, and have to be retrieved by adding a ?fields={field name} to your request.
The Folder Object has a tags parameter that you can fetch, but it is one of the ones not returned by default.
In this case, the API call would be GET /folders/{id}?fields=tags. One thing to note is that it will only return the tags in this case with some basic information (type of object and object id), not the full folder object. If you need other information in the call, you can add it to the fields that you want to pull. For example, if you wish to get the owned_by parameter as well, your request would be GET /folders/{id}?fields=owned_by,tags

Related

When embedding JSON in a Forge WorkItem, what specifies the name of the json file?

I'm following along here, under Additional notes, Input arguments:Embedded JSON, as well as the CountItApp code here (which I assumed was what was being referenced by the first link, but maybe that is a poor assumption?)
In any case, I see that in CountItApp\Main.cs, it is looking for a file called "params.json", but I'm having trouble locating where that name was specified when submitting the WorkItem. Is embedded JSON always called params.json, or is it specified somewhere that I'm missing? Or does it use the value specified in the "post" for the Activity (per the Activity example for InventorParams at that link)?
The name of the params.json is defined on the Activity. When you call the Workitem, the embedded JSON is passed as that parameter and saved with the name defined.

Get Data info from a certain page- MediaWiki API

I'm very new to the api system and i was wondering how to get data from a certain page. So my link is:
https://nookipedia.com/w/api.php
but i want to get my api from this page:
https://nookipedia.com/wiki/Bugs/Animal_Crossing:_New_Leaf
but when i try this:
https://nookipedia.com/wiki/Bugs/Animal_Crossing:_New_Leaf/w/api.php
the link doesn't work and gives me this error:
Error 404: Not found
The requested page or file could not be found on our server. It may have been moved or deleted.
How would i get that certain page?
I suggest you play around with the API sandbox on Wikipedia to see how queries are built. You will still need to read the actual API documentation to get useful information...
Basically, you want to pass the title(s) as a parameter to api.php, like so:
https://nookipedia.com/w/api.php?titles=Bugs/Animal_Crossing:_New_Leaf
However, this will still get you no information by itself; you need to know what data you want exactly, and use the correct API module with the appropriate parameters. For example, to get all the categories of a page:
https://nookipedia.com/w/api.php?action=query&titles=Bugs/Animal_Crossing:_New_Leaf&prop=categories
For this specific example, you can see the documentation for the Query API and the Categories property:
API:Query
API:Categories

How to access both images and extracts on a Wikipedia page via the API?

I am trying to access images and extracts on a Wikipedia page via the API.
According to the documentation, the way to do this is to add prop=images to the request URL.
api.php?action=query&titles=Albert%20Einstein&prop=images
But if I combine extracts and images
api.php?action=query&titles=Albert%20Einstein&prop=images&extracts
I get the following response
parsed_response={"warnings"=>{"main"=>{"*"=>"Unrecognized parameter: 'images'"}}
Each of these works individually. Combining other props (e.g., extracts&exintro&explaintext&redirects) also works.
Why can't I get extracts and images via a single API request?
It should be | in the place of &:
api.php?action=query&titles=Albert%20Einstein&prop=images|extracts
extracts&exintro&explaintext happens to work, because exintro and explaintext are not properties, but extra parameters that can be added when using prop=extracts. To combine them all, use
api.php?action=query&titles=Albert%20Einstein&prop=images|extracts&exintro&explaintext

Inconsistent response (JSON array lengths different) from Google Places API

When I make GET HTTP call to Google Places API. (Example Call: "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=") ....
Under "results", inconsistent number of elements are returned. What is the base list of fields that will always be returned?
In the screenshot below, you can see how the array length count under "results" is different, counts are 11, 10, 10, and 8.
Screenshot below shows how one the JSON Arrays in the response has more elements than the other and the extra fields are circled in red.
I am confused here because I am trying to write code to parse the JSON and trying to understand which are the fields to expect? Missing fields in some arrays in the response is breaking my code.
Am I interpreting the API documentation incorrectly or Is this a bug that I should be filing with Google directly?
You might consider using logic that does not require any fields at all. Because the server is out of your control, it could return anything at any time (due to API changes, bugs, technical faults, etc.)
For example, in Sprockets I loop through whatever objects are returned and if the name matches something that I expect, then I process it. Otherwise the fields in my objects simply remain empty. You can see the top-level processing Java code in the PlacesResponse constructor.
It's not a bug, but documented behaviour. The Google Places API documentation says:
Each result within the results array may contain the following fields:
In other words, Google returns ratings, opening hours etc for places if it has them, but it will leave them out if it does not or the field is not relevant to the place (eg. you wouldn't have opening hours for an apartment complex or rate a train station). As #pushbit says, you have to parse accordingly and check whether each field was returned.

questions wcf rest service with webclient

I'm getting confused on a few things in regards to wcf rest.
If you call a login method, should I use a POST or GET? After implementing a POST, I started to find various articles saying you should only use post to update data, and get for retrieving data. Which is the most appropriate method?
If I had to change the Login method from a Post to a Get, how would I call this?
http://....myservice.svc/login/{username}/{passpord} or is there another way to call this?
Note that in my post method, I'm passing and returning data in json format.
I need to create a search function that requires to pass various parameters i.e. list, string, list, etc... I assume in this instance I would have to define GET method, but again how to I pass these list of objects? Convert them to json first and pass them as parameters?
A brief url sample would be great.
Ok, I guess I'll answer my own question based on further finding when researching it and remember that my answer is based on using JSON as parameters. I'm not sure how it would behave if xml was used as I did not try it.
It appears to make more sense to use POST when logging in as you do not want to display the information you are posting via a url. You could encrypt the data and pass it in the url using a GET method... Again I could be wrong, but that's how I interpreted the various articles I read.
Again, in this instance, it appears POST is the best solution if a) you require a large amount of data to be passed to your url and b) if you do not want to show this data to the user. If your query only requires simple parameters (i.e. userid, type, etc...) and you don't mind showing this info, you can use the GET method.
If you require to pass multiple parameters to a function, you should instead pass a single parameter. This parameter should be a single object. This object should be made of all the parameters you wanted to use in the first place, this way, when using the POST method, this object can easily be converted to JSON and it will handle passing multiple parameters through a single object and it will handle numeric, string, list<>, array<>, etc... very nicely.