Box.com Content API: Add Collaboration - box-api

When using Box.Com APi, Add Collaboration method (https://developers.box.com/docs/#collaborations-add-a-collaboration) there's a parameter that states that its type is object (the accessible_by parameter). This is an example of something that is actually all over the documentation.
Reading the documentation, seems to me that these are objects in mini format, but they don't state the type.

Here is the object format for the accessible_by parameter used in the Create Collaboration endpoint:
"accessible_by": { "id": "USER_ID", "type": "user" }

Related

OData Custom Action Response Restrictions

We have to talk to a Microsoft Dynamics 365 Api. When calling an custom action we retrieve a json as in the example below
{
"#odata.context": "just-a-domain",
"ids": "[{\"account\":\"whatever_id\",\"name\":\"test 2\"}]"
}
As you see the value of ids comes as string, but it should be json. Is there any restrictions for the return values in Dynamics 365?
The expected output should be like
{
"#odata.context": "just-a-domain",
"ids": [
{
"account": "whatever_id",
"name": "test 2"
}
]
}
Didn't find anything about it in the documentation. But the guy who's implementing the custom actions claims it is not possible to do it in any other way.
These are the data types supported in Custom action output parameter:
That being said, JSON is not the straight supported Output param type, but you can ask your CRM developer to give you back some fixed format anyway.
Simply serialized JSON in String Output type, EntityCollection Or Entity types may help you if I understand your need correctly. Read more

Download a Document with Autodesk API

I'm trying to download documents from BIM 360 Docs. If I want to download a file with the type "type": "items:autodesk.bim360:File" I just need to get the bucketID and objectID (/projects/<projectID>/items/<itemID>) and call buckets/<bucketID>/objects/<ObjectID>. (I used this tutorial)
But how do I download a file with the type "type": "items:autodesk.bim360:Document"?
First, I get the version of the document /projects/<projectID>/items/<itemID>/versions. After that I call projects/<ProjectID>/versions/<versionID>/downloadFormats but it returns an empty JSON. The call projects/<ProjectID>/versions/<versionID>/downloads returns a 400 Bad Input. Whats the right way to get the bucket & objectID from a "document"? The way from the tutorial doesn't work because there is no "storage" tag in the JSON (example).
For BIM 360 Project Folder items, follow the tutorial here to download document.
Basically you will need to obtain the URN of the document from the relationships.storage.data.id field via GET projects/:project_id/folders/:folder_id/contents.
For item type items:autodesk.bim360:Document, call GET projects/:project_id/versions/:version_id/relationships/refs to obtain the storage locations:
"storage": {
"meta": {
"link": {
"href": "/oss/v2/buckets/wipbucket/objects/urn:adsk.objects:os.object:wip.dm.prod%2F9f8bdc3f-e29c-4ada-ab7b-bb8dfa821163.pdf"
}
}
See doc here.

Is it good practice to have JSON objects with data that won't be saved to DB?

I'll explain my question with an example: Let's say I have a backend with a SQL DB and a REST API that servers JSON. There's a claims resource in the API which describes claims about an order which contains articles. When I list all the claims I'd like the JSON object for each order claims to have these fields, to limit the API calls:
{
"customerNumber": "112235-12312",
"customerName": "A name"
"orderNumber": "6575-12316",
"claims": [
{
"articleNumber": "24141241",
"articleName": "Article Name",
"claimed": 3
},
...
],
}
For consistency reasons I want the JSON object to be the same for all the HTTP verbs, but in the creation or update of a resource I don't know if it's good practice to send data to the backend which will not be saved to the DB, in this case customerName or articleName. I'd really like to have this data in the JSON object when listing cliams, otherwise, I would have to make many API calls and would make everything slower.

Accessing Google AppEngine Cloud Endpoints using ActionScript 3?

Is anyone aware of method of accessing Google AppEngine Cloud Enpoints using ActionScript 3 without having to go through the JavaScript layer? I have been going on the docs and Google to find any tutorials or examples but did not find anything useful.
We don't have AS3 client libraries and currently there are none planned that I know of, so you'll have to rely on HTTP to make your REST calls.
TLDR; Use the APIs Explorer
If you visit
https://your-app-id.appspot.com/_ah/api/explorer
(replacing your-app-id with your actual application ID), then you'll be redirected to your own custom version of the Google APIs Explorer.
In it you can click on individual APIs and see the list of all available methods. Within a the page for each method, you can try out forming requests and the Explorer will suggest the correct values to use.
After you click "Execute", the full HTTP request (headers and all) and response will be printed on your page, which will show you which commands to use.
Description of how to use the Discovery Document
The Discovery Document for your API will contain all the information you need to construct a request.
To find the root for calling your API, check out the baseUrl key. It should be something like:
https://your-app-id.appspot.com/_ah/api/tictactoe/v1/
To figure out how to call a specific method, there are descriptions of every method, nested down as resources in the Discovery Document. For example, for the Tic Tac Toe Python sample, the board_get_move method has a name of board.getmove in the #endpoints.api decorator. This means the method getmove is owned by the resource board.
If you look in the resources.board.methods key in the Discovery Document you can see the getmove method:
"getmove": {
"id": "tictactoe.board.getmove",
"path": "board",
"httpMethod": "POST",
"description": "Exposes...",
"request": {
"$ref": "TictactoeApiMessagesBoardMessage"
},
"response": {
"$ref": "TictactoeApiMessagesBoardMessage"
}
}
Combining the path with our baseUrl we know requests will need to be sent to
https://your-app-id.appspot.com/_ah/api/tictactoe/v1/board
and from httpMethod we know requests will use the HTTP method POST.
Finally, to specify the request, we see a reference to a schema:
"$ref": "TictactoeApiMessagesBoardMessage"
Looking in the schemas.TictactoeApiMessagesBoardMessage key in the Discovery Document we see:
"TictactoeApiMessagesBoardMessage": {
"id": "TictactoeApiMessagesBoardMessage",
"type": "object",
"description": "ProtoRPC message definition to represent a board.",
"properties": {
"state": {
"type": "string"
}
}
}
so we know the payload must contain a single field called state and that field must be a string.

WCF Data Service - JSON response has extra "results" section

Using the WCF Data Services Toolkit, or the other ways to support the $format param such as JSONPSupportInspectorAttribute I am getting some json responses that are a little odd to me.
Why does my json look like:
{
"d" : {
"results": [
{
"__metadata": {
When the json from OData.org $format is as follows:
{
"d" : [
{
"__metadata": {
Why does mine have an extra "results" sub section?
My data service is just built directly onto my entity framework model. Do I have to use a specific context template for this to go away?
This is versioning. In V2 we added the server driven paging and inline count features which need to store additional metadata on the feed. But since the feed in V1 was just a JSON array, there was no place to put such metadata.
So in V2 all feeds in responses are wrapped in "results" wrapper. That is the feed is a JSON object which has a property called "results" which has the array. There might be additional properties on the feed object (next link, count, ...).
The versioning of the payload is based on the minimum version required by any feature in that payload. So if your service is using something which requires payload of version higher than V1, the entire payload will be written using that higher version.
You can see this even on the odata.org service - try this:
http://services.odata.org/OData/OData.svc/Products?$inlinecount=allpages&$format=json
The response will be V2 and will use the results wrapper.