Sending text file to Jenkins via remote trigger - from excel (VBA) - vba

I have a job in Jenkins that accepts a text file parameter.
Builds are triggered from an excel macro - and I'm having difficulty understanding how to send the file to Jenkins.
Up until now, what I understood is the following:
the file must be sent in an HTTP POST request, in the body.
the file must be sent in multipart/form-data format.
What I can't seem to manage to find out:
how exactly do I encode my file to multipart/form-data in VBA?
how do I send multiple files to Jenkins in the same HTTP POST request?
More information that might be helpful:
I'm using MSXML2.XMLHTTP60.
The job has other parameters (string, password), so I'm using the format:
http://server/job/myjob/buildWithParameters?PARAM1=Value1&PARAM2=Value2
Thank you in advance for any help.
EDIT:
After a lot of headeache, I discovered that currently, the option of sending a file parameter via an http POST request is not supported:
https://issues.jenkins-ci.org/browse/JENKINS-56169
But it has been opened as a new feature request.
The only option is pretending to be the web browser, and sending an http POST request identical to the one the Jenkins server is expecting to receive.
This poses the problem I described in the Jenkins Issue - the server's response doesn't contain the item's location in the queue.

Related

IntelliJ HTTP client with GraphQL requests stored in multiple .http files

I am using IntelliJ 2022.3.1 (Ultimate Edition).
I have multiple .http files containing GRAPHQL requests, for convenience, those files are kept in a subfolder of resource folder in test package, in our Java application. Those requests are defined in multiple files, because for many of them the query is rather big and it was hard to navigate in a single file.
My goal is to make running these queries as easy as possible, to ease testing.
I have already added environment variables with some details, like hostname or token‚ which I set in the headers.
I have also defined live template to prepare request headers quickly, when adding new request.
What I would like to do in addition is:
read query from a file
run queries from all the files with one click
The first problem is:
When I have a GRAPHQL request in .http file, I can successfully trigger it. But when I save exactly the same query in a file and try to load it when triggering request, I get validation exceptions. Is this not possible?
For example, this request works fine:
GRAPHQL {{path}}
Authorization Bearer {{token}}
Content-Type: application/graphql
query {
total {
amount
currency
}
}
But after saving the same query in a file and loading it like below, it fails in the app:
GRAPHQL {{path}}
Authorization Bearer {{token}}
Content-Type: application/graphql
< ./query.graphql
with
Error executing GraphQL request! graphql.kickstart.servlet.InvocationInputParseException: Request parsing failed at graphql.kickstart.servlet.HttpRequestHandlerImpl.parseInvocationInput(HttpRequestHandlerImpl.java:72)
After digging a little bit more, it seems to be a difference in how the request is delivered to the endpoint. It looks like when providing query in the body - the request is packed in JSON, when loading request from a file - the request is sent as is
See difference:
// This works
POST /my-graphql/graphql, payload={"query": "query {\n total {\n amount\n currency\n }\n}"}
// This fails
POST /my-graphql/graphql, payload=query { total { amount currency } }
Looks like IntelliJ bug?
The second issue is that when I right click on a folder to run all requests, IntelliJ gives me option to run all tests - which is not what I want. Is it possible to create run configuration to execute all .http requests from multiple files?
It looks like neither of above is possible now:
Loading query from a file: bug reported here: https://youtrack.jetbrains.com/issue/IDEA-310914/IntelliJ-Http-client-and-GraphQL-request-fails-when-loading-query-from-a-file
Triggering multiple .http files simultaneously - not possible, feature voting here: https://youtrack.jetbrains.com/issue/IDEA-239323

Informatica HTTP transformation, End point URL does not give response for GET method

I am trying to use HTTP transformation for getting response from an api. Here I am not sending any token or credentials for authorization. I am just using blanK text file as source and in HTTP transformation mentioned the URL. Below is mapping
SQ(Blank text file)-->HTTP(GET method and URL)-->http response(FlatFile)
Kindly correct if I can use blank text file as source since I am not sending any data for GET request. I am getting error as follows in the image
This error is not about data being sent. The error mentions a problem with the certificate. One of certificates in the chain is self-signed - this means (briefly) it cannot be trusted. Try reading this thread for more info.

how to attachment a file to an xml request with postman?

Hello friend I need to make a request that I manage to do correctly from SOAP-UI but now in postmant , from SOAP-UI I do the following
I attchemnt a file and configure my request as follows
now I want to replicate this in postman but I don't know how to help me.
One option would be to send the bs64 inside the field

Azure logic app API http response with excel file download using Postman

Created azure logic app HTTP request it gives response for normal JSON schema However, I want to attach SharePoint excel sheet when I trigger the request from Postman.
1.How to used content type or schema to download the attached file. when postman request sent.
2.is that possible to download when you hit API through logic app
3.Generated HTTP POST URL is working
For your requirement, I test it in my side. It seems we do not need to set any value for "Content-Type" in headers of response. Please refer to my logic app below:
Then when you request the logic app url in postman, please choose "Send and Download" instead of "Send".
After that, you can download the file when request the url in postman.

WSO2 API Manager is not responding to a request that returns zip file (application/octet-stream)

Using WSO2 API Manager 1.3.1. Trying to use the API Manager to proxy to a REST service. I have set up the service in API Mgr and can successfully post and get responses, typically json, though some are text.
However, when I try to GET a resource that returns binary content (a zip "file", content-type:application/octet-stream), the API Manager does not seem to respond and I can see an error in the console window (i'm running wso2server.bat in console):
[2013-07-03 11:52:05,048] WARN - SourceHandler Connection time out
while writing the response: 173.21.1.22:1268->173.21.1.22:8280
I have an HTTPModule on my internal service and it seems to be responding with the appropriate content (I can see the GET and response data logged). I can also call to the internal service directly and get a response, so that end of things seems OK. But going through the API Manager seems to fail.
I found information on enabling other content-types:
WSO2 API Manager - Publishing API with non-XML response
http://wso2.com/library/articles/binary-relay-efficient-way-pass-both-xml-non-xml-content-through-apache-synapse
Using that information I tried to enable the application/octet-stream for messageFormatter and messageBuilder using the binary relay and it did not help (or seem to make a difference). I have even disabled all other content-types and use the binary relay for all content-types and it does not help.
Currently, I'm running with just the following in both axis2.xml and axis2_client.xml (in their appropriate sections):
<messageBuilder contentType=".*" class="org.wso2.carbon.relay.BinaryRelayBuilder"/
<messageFormatter contentType=".*" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
I still get my json and text responses, but WSO2 times out getting the zip content. I saw the JIRA referenced in axis2.xml about enabling the ".*" relay, but as the other requests seem to work, I'm not sure it's an issue for me. I did try adding
'format="rest"' to the API definition, but it seemed to break all operations even the ones that worked prior so I've pulled it back out.
Any ideas on what is happening or how to dig in and debug this will help. Thanks!
After working with this for much too long, it turns out that my WSO2 configuration was correct, using the Message Relay and BinaryRelayBuilder, etc. While my REST service could reply immediately, I was setting a HTTP header that I assume WSO2 does not like, because when i removed it WSO2 would reply at an expected rate (instantly).
I was setting the header:
Transfer-Encoding: binary
When I removed that header from my service reply, then WSO2 operated as expected. I don't know if that's a "bug" in WSO2 or if I was implementing incorrectly, but I do have what seems like a "workaround" by omitting that header from my service response.