API call directly from Design Automation Activity - autodesk-forge

I am trying to follow DA tutorial to extract data from CAD file and post the data to a web api. Probably I can extract and save a data file in OSS( or somewhere temporarily, I haven't figured out yet), and use my web app to read this file before sending the api request. Instead of this double handling, is it legal to call API directly from Activities? Same like a plug-in in laptop, it programs a local file and then sends a HTTP call.
Thank you.

is it legal to call API directly from Activities? Same like a plug-in in laptop, it programs a local file and then sends a HTTP call.
Currently it is not possible to send Http requests from within Appbundle code, this is something our Engineering team researching.

Related

How to call third party site's json api from shopify custom app

I created custom app in shopify admin. But I don't know how to call thirdparty site json api with that app. Can anyone help me about this.
In your App, set up the App Proxy. That is an endpoint in your App, GET or POST that you can receive data at. Shopify will call that endpoint with security so you know inside your App the call is a good one. Since you are inside your secure App, this is the place where you can call your third-party API to get data. Once that call completes, you can return JSON to Shopify.
In Shopify theme, the call is /apps/my_end_point with data. Shopify mangles all that, and sends it to your Proxy. So your proxy get data from the front-end, and you can then safely call your APIs, and return JSON to Shopify.
Simple and elegant pattern of use you have to use. There really is no other way to do it securely.

How to test WebHooks without an on-premise external system?

I'm trying to teach myself about integrating systems via WebHooks.
In a free/hosted GIS system, I can create a WebHook that would, in theory, POST a JSON object to an external system.
The problem is, I don't have an external system that's available right now for for receiving the POST.
I think I need some sort of publicly available sample server that would:
Receive the POST requests
Do something with the requests (ie. create some sort of record)
...so that I could determine if the WebHook worked correctly or not.
How can I test my WebHooks without having an on-premise external system?
I've poked around websites like Postman Echo and Amazon Lambda. But to my untrained eye, it seems like they're not quite designed for what I need.
You could use any of these options depending on your requirements:
You could use webhooks modules in services like Integromat or Zapier to receive webhook data and then apply transformation.
You could deploy a script on heroku and use the URL generated there to send the webhooks calls.
You could also use services like requestbin, webhook.site etc if you just want to receive webhooks data.
Regards

Access Google Drive REST without google sdk

I have a lightweight node.js module that needs to pull from google drive. They have a REST/HTTPS interface but AFAICT it's only accessible via their SDK. I want to use REST/HTTPS so I don't have to use an SDK. Is this possible for file download? For file find (file:list e.g. https://developers.google.com/drive/v3/reference/files/list)?
I don't understand why you think it's only accessible using an SDK. The link you posted clearly shows the URL endpoint, lists the optional parameters and gives the format of the JSON response.
If you click "Try it now" and open your browser console, you will see the http request and response which you can mirror in your app.
The only thing you also need to consider is that before making a REST request to Google, you must obtain an Access Token and set it in an Authorization: Bearer xxxxxxxx header, or provide it as a query parameter as &access_token=xxxxxxxxx

How to upload application to Cloud Foundry using API (not CLI)?

I'm trying to develop a simple NodeJS web app that can more or less replace the Cloud Foundry (CF) CLI. I'm following the API documentation to send the application.zip to the CF Service, however I get an error response Unsupported Media Type.
For the application part of the body I'm sending the application.zip file that is uploaded from the browser.
For the resources part of the body I'm sending an empty Json array. My understanding is that as there is nothing uploaded initially there are no pre-uploaded resources that I want to specify, hence the array is empty.
With the Unsupported Media Type response, I suspect you send invalid request headers to the API. There is a CloudFoundry API client written in node.js and you may read the source code to see how they upload the app code.
If that does not help you, please refine your question and add some code that you have.

Box View API : Is it possible to upload a file directly?

I was wondering if it is possible to upload a file directly to be used with the Box View API without saving it on my local server. The idea is users will be able to upload a file (pdf, ppt. etc) and it will be used only with the Box Viewer and not saved in my server. Users will be uploading many large files and I am looking to avoid storing them.
I know Box requires a URL of the file location for it to generate the content, but is there a way for the file to be uploaded and handled with the View API?
If anyone knows of a solution it will be greatly appreciated! Thanks.
There's no way to upload directly from the user's browser, because the API does not supply CORS headers. This is for security reasons, because in order to upload directly from the client, you'd have to expose your API token (which you definitely do not want to do).
One way to not store the files on your server would be to essentially proxy a multi-part upload request to the View API (see this gist for an example of how to do it with node.js). The other option would be to use a service such as FilePicker, which allows users to select files from their own computer or any number of other services, and it just returns a URL that you can simply pass to the View API using the URL upload.
The multi-part API is only an option if you are sending large files. Here's a response from trying to send a small file:
{"data":
{"code":"file_size_too_small",
"message":"File size 23 less than minimum allowed for this API: 20000000",
"request_id":"aab58e965e91c8aa7283b2faddec5ab3"},
"status":400,"config":{"method":"POST",
"transformRequest":[null],
"transformResponse":[null],
"jsonpCallbackParam":"callback",
"url":"https://upload.box.com/api/2.0/files/upload_sessions",
"headers":{"Authorization":"Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type":"multipart/form-data",
"Accept":"application/json, text/plain, */*"},
"data":{"folder_id":"111111111111",
"file_size":23,
"file_name":"TestUploadFile.txt"}},
"statusText":"Bad Request",
"xhrStatus":"complete"}