Bluemix API connect POST request (form data) file attachment issue - ibm-cloud

In API connect, I was working with one of the 'path' in API which requires file upload using multipart/form-data (POST request). I was not able to find out any support for it though.
While adding parameter there is no support for 'file' type (located-in: form-data). Is there something which I am missing in my setup? Is there any other way to attach file in request via API connect ?
I am using API Connect "Essentials" plan.
Thanks

I think that you can just leave the type blank:

Related

Why is payload URL optional in Facebook Send API

I am using the Facebook Send API and I wonder why the url property of message.attachment.payload is optional? I don't understand how you would send a file without specifying a URL, am I missing something or is this just an error in the docs?
As of writing this, there seems to be a missing field in the API table : you can specify a attachment_id to reuse a previously uploaded attachement.

Data Factory can't download CSV file from web API with Basic Auth

I'm trying to download a CSV file from a website in Data Factory using the HTTP connector as my source linked service in a copy activity. It's basically a web call to a url that looks like https://www.mywebsite.org/api/entityname.csv?fields=:all&paging=false.
The website uses basic authentication. I have manually tested by using the url in a browser and entering the credentials, and everything works fine. I have used the REST connector in a copy activity to download the data as a JSON file (same url, just without the ".csv" in there), and that works fine. But there is something about the authentication in the HTTP connector that is different and causing issues. When I try to execute my copy activity, it downloads a csv file that contains the HTML for the login page on the source website.
While searching, I did come across this Github issue on the docs that suggests that the basic auth header is not initially sent and that may be causing an issue.
As I have it now, the authentication is defined in the linked service. I'm hoping that maybe I can add something to the Additional Headers or Request Body properties of the source in my copy activity to make this work, but I haven't found the right thing yet.
Suggestions of things to try or code samples of a working copy activity using the HTTP connector and basic auth would be much appreciated.
The HTTP connector expects the API to return a 401 Unauthorized response after the initial request. It then responds with the basic auth credentials. If the API doesn't do this, it won't use the credentials provided in the HTTP linked service.
If that is the case, go to the copy activity source, and in the additional headers property add Authorization: Basic followed by the base64 encoded string of username:password. It should look something like this (where the string at the end is the encoded username:password):
Authorization: Basic ZxN0b2njFasdfkVEH1fU2GM=`
It's best if that isn't hard coded into the copy activity but is retrieved from Key Vault and passed as secure input to the copy activity.
I suggest you try to use the REST connector instead of the HTTP one. It supports Basic as authentication type and I have verified it using a test endpoint on HTTPbin.org
Above is the configuration for the REST linked service. Once you have created a dataset connected to this linked service you can include it in you copy activity.
Once the pipeline executes the content of the REST response will be saved in the specified file.

How to hit SAP HANA rest APIs through postman?

I am trying to hit SAP HANA's rest APIs but unable to get started because i didn't get any proper document that specifies the steps that i can use to hit APIs through POSTMAN(or any other rest client). Do i need to install anything before using the resp APIs or are they available to be used directly? Also what all are the parameters that i need to mention while hitting the API and what is the base URL that is to be used?
Ok, the HANA XS API is documented: SAP HANA XS JavaScript API Reference
For the error: most likely, you're not using any authentication in Postman. When you e.g. switch to "Basic Auth" and key in your HANA username and password, something like this
https://<hostname>:43<instance no>/sap/hana/xs/dt/base/info
should work.
Below is sample Request in to Hit REST API Using Postman :
1. http://localhost:8080/my-rest-api/progress-report?name=shekhar&region=east&address=India
Add Headers Info if any : like
accept : application/json;v=1
contentType : application/json;v=1

wso2 api manager 1.6.0 query parameters not accepted

I am using wso2 API manager 1.6.0 and would like to create an API which accepts any POST
on /users resource followed by any query parameter such as "clientid" (as described below)
restserver.com:8280/context/1/users?clientid=333
I have created an API in API publisher as follow :
URL Prefix URL Pattern HTTP Verb
/context/1 /users/* POST
Any POST on /users is accepted but as sson as I add a query paramter /users?clientid=333 , the request is rejected by the API Manager gateway with 403 error.
Could someone advice me on this and what should be the correct url-mapping format ?
The resulting url-mapping in synapse config file is as follow : (synapse-configs/default/api/)
Thanks a lot.
JS
For this you need to define uri-template instead of uri-mapping. This blog post explains more about this.
For your case I got it working as following.
Open your API configuration source which can be found at AM_HOME\repository\deployment\server\synapse-configs\default\api folder.
In the resource tag change url-mapping="/users/*" attribute to uri-template="/users/*"
But you will have to invoke the API as follows with additional context because when you say /users/* it means anything can come after users/. So you need to have a / after users context.
restserver.com:8280/context/1/users/usr?clientid=333

Access Public Skydrive Content Using Live Connect REST Without Access Token

According to this Microsoft api page
http ://msdn.microsoft.com/en-us/library/live/hh826522#reading_albums
, I tried to translate this browser access skydrive URL
https://skydrive.live.com/?cid=0A263A7CBEAAFB80&sc=photos#cid=0A263A7CBEAAFB80&id=A263A7CBEAAFB80%214521&sc=photos
to
http://apis.live.net/v5.0/folder.0A263A7CBEAAFB80.A263A7CBEAAFB80!4521
Since the album is shared to public, I should be allowed to access without access token.Am I missed something? Or is just using the wrong URL?
I notice I can get public profile by using this
https ://apis.live.net/v5.0/0A263A7CBEAAFB80/
And I have read the REST API
http ://msdn.microsoft.com/en-us/library/live/hh243648.aspx
, but I found it is hard to deduce the correct url format
This get all albums
https ://apis.live.net/v5.0/0A263A7CBEAAFB80/albums
REST URL also fails.
I've been looking for a guide for this as well, but just noticed that your URL appears to have an additional '/' in it. The one listed on the site is:
https://apis.live.netv5.0/%fileid%
Were you able to get this to work?