attaching file with RESTWorkItemHandler - rest

Good day,
Is there any way to attach file with RESTWorkItemHanlder to call REST service?
I could test rest calls with Postman but would like to have it on rhpam side, is there any possible way to send rest call with attached file (just simple pdf file)?
No documentation found with explanation, unfortunately.

Related

Api to Api Comunication and data transformation

Good day,
I want to communicate between two Web Api's, the first web api lets call Api1 not written by me and that api interacts with my data base to spit out information needed.
I have web api2 which would be written by me and why i have this is because my application needs data in certain kind of format (.dll) format.so api2 purpose is to get the information from api1 and then transform or package my data in a way that the my application would understand.
The question, is this possible?. can i use wrappers, so when i get my information from api1 then i wrap my information in the desired format before sending it off to the application. Does anyone have any other suggestions ?
Thank you in advance,
What you describe is possible but the requirements are too vague to give a useful answer.
The file extension doesn't really mean anything so not sure why you need .dll format for the message. I would use a standard format like Json or Xml. Or if using datawindow you could simply do saveas on sending side (or comma delimited, tab delimit) and file import on receiving end, so many options.
Too vague.
Async or Sync interface?
Files transferred via REST, OLE, DDE, or files written to location on server?
Are the files/data transferred specific to a logged in user?
How much data is being transferred, rows of information or configuration data? Answer will help in deciding on appropriate format & best method.
What type program is API #1 not in your control? That is important factor.

How to add devices using openHAB REST API

I am looking for a way to discover a USB zstick "/dev/ttyACM0" using OpenHab command line interface as I am not going to be using a GUI and I need to create a script to automate few things.
In their website here and here OpenHab have some documentation, and that's what I found for discovery:
GET /discovery
POST /discovery/bindings/{bindingId}/scan
however I was unable to make that into a useful curl command. any idea on where to start?
I would suggest to try out the REST Documentation, for finding the right endpoint/expression.
You can install it through paper ui:
It will then be available through <YOUR_OH_IP>:<PORT>/doc/index.html.
It provides some ui with explanations and examples for the endpoints and you can test them live through it.
This should help you find the correct rest call to use with curl afterwards.
I don't know if adding devies through REST is possible. If so you can find it in the REST Documentation.
If it doesn't work though the REST API you might want to write a small bash script which adds the things you want. Then you can call your script with
executeCommandLine in a rule

MQL4 Trade feed as a WEB API

Does someone had any idea or created a webservice REST API in JSON format, which another remote server can fetch the data from.
Just need some beginner's lesson how to setup it on MQL4. My client needs this kind of service, which we will then output on a Wordpress as Widgets.
I want to know how our Wordpress server can access this. MQL4 had this WebRequest() function and planning to use it, but don't know where to start.
A number of options possible.
you can:
a. create web api call to save incoming data (ticks/candles) into db.
create mql4 script to send data via api.
or
b. create c++ / c# dll to save data into db.
separately create web api in language of your choice to read from db.
enter code here
or
c. save file into web accessible folder in format you like and read the file from word press.

Upload a document to Socrata using REST API

I am attempting to upload a file to a socrata site using their REST API. The file(s) I am trying to upload can be access directly by my application and could be serialized, or I could point Socrata to a url. The rest of the datatypes I am using are pretty straight forward; strings, dates, ect. But I can't seem to find any documentation on how to upload a file using REST with Socrata.
Is it even possible?
Thanks in advance.
There's no "official" way of uploading files to Socrata, hence no documentation. If you want to attach a file to the dataset programmatically, then what existing libraries (Java in this example) do is use the /api/assets endpoint (which, if I'm not mistaken, is what the UI uses for uploading documents) and do a multipart POST.
soda-java's SodaDll::addAsset()
soda-java's HttpLowLevel::postFileRaw()

Best approach to send big files to a server in a automatic way using a rest api?

I need to to send files to a server using rest api. I cannot use a browser as a client and the file should be sent with a http method. It has to be made automatically (using jenkins or so).
All I want to know is what is the best approach. The best way to do this. I have found several info but always using a form in the client side. I cannot use that.
You can do it also without form. What about encoding it in base64?
Look to this solution, by far the best I guess.
The best way to do this is to simply PUT the file to the target URI. If you need to upload larger files, you might want to split it in parts and join them later, when finished.