Handle form-data using Azure APIM policy - azure-api-management

Disclaimer : I am very new to Azure API Management
Hi Friends,
I have the following requirement to be accomplished -
The user will upload an image from a mobile app as "form-data".
An API will be called through Azure APIM and the image will be stored in Blob.
The call should also invoke a backend API at the same time along with the image which does processing and gives the result back.
Could you please suggest how should I proceed on writing the APIM policy for this. I am aware of handling the image at the API side if it comes as part of JSON data. I am just looking for suggestions on the APIM part or more precisely about how to write the policy if the image is part of form-data.
Any help is appreciated.
Thanks and Regards,
Amit Anand

I am just looking for suggestions on the APIM part or more precisely about how to write the policy if the image is part of form-data.
I have reached out to the APIM team for this scenario and they've confirmed this isn't supported at this time. The recommendation is to use JSON payload and, parse & consume accordingly.
If you feel strongly about this, please consider submitting a feature request on Azure UserVoice for the APIM team to review for the product roadmap.
Refer to this issue.

Related

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

Create Signed URL for Object in BIM360 OSS

I'm trying to set up an Signed URL for an Design Automation Workflow which is triggered by an Webhook inside of the BIM360 OSS. If a file is added the webhooks triggers an endpoint to start a Design Automation. The webhook is working. And the Design Automation is working too. The Problem occurs if i try to wire both up. I#m trying to create a Signed URL of the File like suggested in this post from Petr Broz link stackoverflow.
To use this API it is requierd to use an Token which is obatined by 2-Legged-Auth which is working with all necessary Scopes. In the response of the Webhook is an ID for the Folder and Version. The API is recognizing the ID.
The problem occurs in the response of this endpoint to create the signed url: https://developer.api.autodesk.com/oss/v2/buckets/:bucketKey/objects/:objectKey/signed
I'm using the wip.dm.emea as bucket because the file is stored in the EU BIM360 OSS.
The response is a 403 Forbidden:
{
"reason": "Only the bucket creator is allowed to access this api."
}
Is it even possible to get the File ID like in this example Forge how to Download File ?
Because this Solution requires a 3-Legged-Auth Flow which is not possible for a complete Automation.
The thing which makes me question is, that you can achieve this Workflow in plane Forge. But not in BIM360 where i have no control over the Buckets that are created by the System!?
I think this is an architectural missmatch between the Forge API and the BIM360 implementation!? Will there be a solution for this in the future?
Best regards
Jan
Unfortunately, I can confirm that it's not possible to create a signed URL for your BIM360 storage currently, as the error message mentioned, the endpoint requires the bucket owner to do this operation, this is what it is now. But I agree with you that this should be an architecture mismatch between Forge OSS and BIM360 implementation, and it's already been requested in our system, please keep "CPOSS-1066" to check with us about the progress.
As for the current way, you can keep the 3 legged token and using that for the output Url and also in the onComplete() callback, I have the blog post https://forge.autodesk.com/blog/upload-your-design-automation-output-file-bim360-docs which details the way to work, hope it helps at this moment.

Development Purpose Only watermark even after adding client id and key in https request

I'm using the url as below to request the Google Maps API, and getting Developer purpose only in output. https://www.google.com/jsapi?sensor=true&libraries=places&key=**********&client=*******
Can anyone help me what is wrong with the request format. Should I use url like this: https://maps.googleapis.com/maps/api/js?sensor=true&libraries=places&key=***********&client=*********
Tried both the urls in the request but getting development purpose only watermark on maps.
Map in the web application without any watermark.
The problem here is you are both using the "key" parameter for API key and "client" parameter for client ID. You should only choose one type of authentication. Using both will lead to an error, just like what you are experiencing right now.
This is the correct way to load Javascript API key:
You can learn more here.
If you have a Premium Plan license and wish to use your client instead:
This Detailed guide for Premium Plan customers will be a big help to you.
Also, you don't need to the "sensor" parameter anymore.
Hope my answer helps!

Find what parameters should I send for a POST request

I am trying to call a web service with a POST request, but I do not know the name of parameters that should be sent in the request. All I know is the address of the web service. Based on that, how can I find the parameters names?
Thank you for your advice,
Cheers.
For SOAP services you could get the interface from published WSDL. For HTTP based web services (REST), WADL was designed to describe the functionality, but it is not widely used, and it is not standarized by W3C.
Therefore, if you are not using SOAP, I suggest to look at documentation

Stubbing an API with Azure API Management

I was wondering if someone was able to provide some information regarding the Azure Management Portal. My question is whether the Portal can cater for stubbing APIs?
I have added an API via the Portal as well as some operations however, the documentation isn't clear whether the real API has to be published to Azure.. I was thinking I can add example requests and responses without a real API behind it, i.e. a stub?
You can add a stub easily enough. See the default 'echo' endpoint that comes with each new API that you add to API Management. Copy that pattern and you can build a stub. The API Management documention is some of the better content for Azure so I'd recommend reading it.