We are facing a scenario where we need to create and update (i.e. re-create with overwrite) MANY virtual services based on RR pairs. Our ideia is use the REST API to do it automatically, but we can use commmad line calls if needed.
On re-creation we need to keep the same listen port, to avoid change on consumer side every time.
We found in the documentation the option to use a 'serviceProperties.xml' to set the listen port. For example:
But I was unable to figure out how create the POST request to use the 'createService' API operation; specially how to 'upload' the files. In fact, our question is more retaled to REST use.
Someone can show me an example?
We will automate everything using Python or Java, but first we need to understand the messages formats.
For testing purpose I tried to create on the Portal also, but it doesn't accept the 'serviceProperties.xml' file.
Thank's in advance.
We understood the API documentation and tried it with POSTMAN.
Now we are getting an error like there is no file content:
com.itko.lisa.invoke.api.exception.BadRequestException: File is not provided
But, as you can see in the image below, the content is being sent:
Can you show a listing of what you have inside the zip file?
I have tried with many ZIP files, always with RR pairs inside (sometimes without the serviceProperties.xml).
For example, a ZIP file with two dummy files inside like this:
<order> <id>1-11</id> <name>Nut</name> <product>2mm nut</product></order>
<order> <id>1-11</id> <name>Nut</name> <quantity>47</quantity></order>
I'm always getting a File is not provided error.
I just used your RR pairs in a zip file and am able to invoke and create the VS.
Here is a screenshot from Postman -
Based on the screenshot, go ahead and give it a shot and let me know if you are not able to still generate a VS.
Can you also please share, what details need to be add in Authorization and Headers tab? I'm getting 401 unauthorized error in response
<removed previous comment> Updated: Koustubh was correct. I got it to work when I switched to postman and used VSE for the serviceName. Some of my properties file elements -- such as service name and port -- did not seem to take affect. Will need to do some additional research.
Hi J_NeSmith ,
did you find anything on your below comment
" Some of my properties file elements -- such as service name and port -- did not seem to take affect.Will need to do some additional research.". if so kindly share your findings.
Hi Balamurugan, I did not find anything out. My guess is that I made an error during in the setup.
Thank you Koustubh.Warty. I paid attention in your print screen I saw that you use 'file' instead of 'body' in your variable's name. I changed and it works.As you can see in the image below, it is wrong in the APIs documentation. See below.
The body here refers to either the file or the file URI. If you look at the example shared by Koustubh, the file attachment goes into the body section of the request. Please let me know if that answers your question.