How to import text into postman - postman

I am new to postman and am given what I believe is a postman export. I can manually add these fields into postman but is there a quicker way to import into postman? I tried to import in postman via raw text, but unrecognized format.
POST /WebService/WebService.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Host: dev.helloworld.com
User-Agent: PostmanRuntime/7.28.4
Accept: */*
Postman-Token: f62e3cd8-91c0-4238-844c-592aeb19e0a3
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 596
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<sDatabaseName>Apples</sDatabaseName>
</soap:Body>
</soap:Envelope>

That doesn't look like a Postman export.
That looks like a (raw) console log output.
A Postman export would be in JSON format.
The information you have would need to be input manually as you have described.
However, once it has been input, you could then export the collection you create (in JSON format) and you would have a copy that you can then re-import whenever you need to.
Alternatively, if you have the cURL command you could import that as raw text.

Related

MS Dynamics CRM error HTTP/1.1 400 Bad Request

I am trying to call Microsoft Dynamics CRM web service CustomBinding_IOrganizationService and the SOAPAction is Retrieve using SOAP UI
I am using NTLM authentication type
SOAPAction - http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Retrieve
Accept - application/xml, text/xml, */*
Content-Type - text/xml; charset=utf-8
Below is my xml request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:con="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soap:Header/>
<soap:Body>
<ser:Retrieve>
<!--Optional:-->
<ser:entityName>contact</ser:entityName>
<!--Optional:-->
<ser:id>B1180AE1-19F5-E011-820D-00505610126C</ser:id>
<!--Optional:-->
<ser:columnSet>
<!--Optional:-->
<con:AllColumns>false</con:AllColumns>
<!--Optional:-->
<con:Columns>
<!--Zero or more repetitions:-->
<arr:string>fullname</arr:string>
</con:Columns>
</ser:columnSet>
</ser:Retrieve>
</soap:Body>
</soap:Envelope>
I am getting below response
HTTP/1.1 400 Bad Request
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html
Server: Microsoft-IIS/7.5 Microsoft-HTTPAPI/2.0
Persistent-Auth: true
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 07 May 2019 15:01:34 GMT
Bad Request
Can you please help me to correct where the issue is?
The issue has been resolved as the service was down during that period

Facebook Graph API: How To Publish Text To Page, Including Image Attachment?

The documentation gives an example of how to upload an image, not via url, but as an attachment:
https://developers.facebook.com/docs/messenger-platform/reference/attachment-upload-api
curl -F "message={'attachment':{'type':'image', 'payload':{'is_reusable':true}}}" -F "filedata=#square.png;type=image/png" "https://graph.facebook.com/v2.12/1843037429354999/photos?access_token=<ACCESS_TOKEN>"
This leads to the following request:
POST https://graph.facebook.com/v2.12/<MY_PAGE_ID>/photos?access_token=<MY_ACCESS_TOKEN> HTTP/1.1
Host: graph.facebook.com
User-Agent: curl/7.52.1
Accept: */*
Content-Length: 2833
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------c71046aadf1a4e33
--------------------------c71046aadf1a4e33
Content-Disposition: form-data; name="message"
{'attachment':{'type':'image', 'payload':{'is_reusable':true}}}
--------------------------c71046aadf1a4e33
Content-Disposition: form-data; name="filedata"; filename="square.png"
Content-Type: image/png
<IMAGE_DATA>
--------------------------c71046aadf1a4e33--
However, this example does not work as advertised. The json object in the message parameter is literally posted as text in the post.
I'd like to be able to send along json post data that includes a 'message' and a 'access_token', so that I don't have to include the access token in the url.
How can I ensure that the type/image/payload json object is applied as a configuration, rather than used as the literal post message?
And how can I send along 'message' and 'access_token' in the postdata?
Found the solution.
This command...
curl -F "access_token=<MY_ACCESS_TOKEN>" -F "message=This is the message I wanna post." -F "filedata=#square.png;type=image/png" "https://graph.facebook.com/v2.12/<MY_PAGE_ID>/photos"
Gives this working request:
POST https://graph.facebook.com/v2.12/<MY_PAGE_ID>/photos HTTP/1.1
Host: graph.facebook.com
User-Agent: curl/7.52.1
Accept: */*
Content-Length: 3077
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------e94f377a15b0500f
--------------------------e94f377a15b0500f
Content-Disposition: form-data; name="access_token"
<MY_ACCESS_TOKEN>
--------------------------e94f377a15b0500f
Content-Disposition: form-data; name="message"
This is the message I wanna post.
--------------------------e94f377a15b0500f
Content-Disposition: form-data; name="filedata"; filename="square.png"
Content-Type: image/png
<IMAGE_DATA>
--------------------------e94f377a15b0500f--
All of a sudden it dawned on me. If the 'message' parameter posts a message, then why not simply put the message I want to post in there. Might as well include 'access_token' then, too. And it worked.
Instead of the deprecated 'message', you can also use 'caption' and it will also work.
Anyway, I can now attempt to reproduce this http request from C#. Glad I found this, because it saves me the effort from having to install the Facebook PHP SDK just to see how such a request should be formed.
(Why is there so little Facebook Graph API C# support, anyway?)
I still have no idea how to properly send along the attachment/type/image/payload json object from Facebook's documentation, though.
Oh, well.

How to format a SOAP request

I want to access an online program via the command line within a bash script. I've been told I can run a SOAP request in order to access the software. This is the request I've been told I can use.
POST /OnlineAnalysis/Service.asmx HTTP/1.1
Host: cydas.org
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.cydas.org/OnlineAnalysis/analyseKaryotype"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<analyseKaryotype xmlns="http://www.cydas.org/OnlineAnalysis/">
<strKaryotype>string</strKaryotype>
</analyseKaryotype>
</soap:Body>
</soap:Envelope>
I've never run a SOAP request before but it looks like I'm able to use the curl command based on this question. I've tried to model my curl command according to the link I posted
curl -X POST -H "POST /OnlineAnalysis/Service.asmx HTTP/1.1" -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction: \"http://www.cydas.org/OnlineAnalysis/analyseKaryotype\"" -H "Host: cydas.org" --data-binary #request.xml
And am getting this output
<HTML>
<HEAD>
<TITLE>405 Method Not Allowed</TITLE>
<BASE href="/error_docs/"><!--[if lte IE 6]></BASE><![endif]-->
</HEAD>
<BODY>
<H1>Method Not Allowed</H1>
The HTTP verb used to access this page is not allowed.<P>
<HR>
<ADDRESS>
Web Server at cydas.org
</ADDRESS>
</BODY>
</HTML>
<!--
- Unfortunately, Microsoft has added a clever new
- "feature" to Internet Explorer. If the text of
...
These are the contents of my request.xml file below
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<analyseKaryotype xmlns="http://www.cydas.org/OnlineAnalysis/">
<strKaryotype>46,XX,del(3)(p11)</strKaryotype>
</analyseKaryotype>
</soap:Body>
</soap:Envelope>
I'm not sure what the expected output is supposed to be yet because I can't run the program. I just want to get my SOAP request running properly.
try this:
curl -v "http://www.cydas.org/OnlineAnalysis/Service.asmx" -H "Content-Type: text/xml;charset=UTF-8" -H "SOAPAction: \"http://www.cydas.org/OnlineAnalysis/analyseKaryotype\"" -H "Connection: Keep-Alive" -H "Host: www.cydas.org" --data #request.xml
The server responded with the message: "The Karyotype del(3)(p11) is not valid:
Non-specified error in chromosome count element (del(3)(p11))"
Here's the complete response message:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<analyseKaryotypeResponse xmlns="http://www.cydas.org/OnlineAnalysis/">
<analyseKaryotypeResult>
<Original_ISCN_Formula>del(3)(p11)</Original_ISCN_Formula>
<IsPolyClonal>false</IsPolyClonal>
<IsValidKaryotype>false</IsValidKaryotype>
<Corrected_ISCN_Formula/>
<CloneSize>0</CloneSize>
<IsIncompleteKaryotype>false</IsIncompleteKaryotype>
<Ploidy>0</Ploidy>
<ErrorMessages>The Karyotype del(3)(p11) is not valid:
Non-specified error in chromosome count element (del(3)(p11))</ErrorMessages>
</analyseKaryotypeResult>
</analyseKaryotypeResponse>
</soap:Body>
</soap:Envelope>
cURL is a great tool, but if you want a nice gui you can try other tools like SoapUI or Postman for testing APIs. SoapUI is a standalone Java application and Postman is a plugin for Chrome. They're both free.

Error calling WSO2 API Manager Admin Servces via soapUI

I am experiencing an error calling WSO2 API Manager v2.1.0 Admin Services via soapUI. It seems that the requests that are changing state in API Manager like this one, addRole, are failing. Note that "read only" style requests like listAllUsers or getAllRolesNames are succeeding.
Here is the raw request from soapUI:
POST https://localhost:9443/services/UserAdmin.UserAdminHttpsSoap11Endpoint HTTP/1.1
Accept-Encoding: gzip,deflate
SOAPAction: "urn:addRole"
Authorization: Basic YWRtaW46YWRtaW4=
Content-Type: application/soap+xml
Content-Length: 283
Host: localhost:9443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:addRole>
<xsd:roleName>test_role</xsd:roleName>
</xsd:addRole>
</soapenv:Body>
</soapenv:Envelope>
Here is the response form soapUI:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:VersionMismatch</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Transport level information does not match with SOAP Message namespace URI</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Here is the log entry that appears in wso2carbon.log:
[2017-03-03 16:23:03,474] ERROR - ResponseTimeCalculator wso2statistics.request.received.time is null in the IN MessageContext
Any help is greatly appreciated.
Thanks!
Looks like your request is a SOAP 1.1.
In that case, the Content-Type of the request should be text/xml, not application/soap+xml.
If that doesn't work, try using RemoteUserStoreManagerService instead of UserAdmin.

Upload file to Drive and set file name

I want to upload a file to Google Drive and set its name as I understood I have to use uploadType=multipart
I am under c++ and using cURL lib.
How can I proceed?
You need to make a multipart request with metadata and media parts. Use curl_formadd and make sure your request looks like:
POST /upload/drive/v2/files?uploadType=multipart HTTP/1.1
Host: www.googleapis.com
Authorization: your_auth_token
Content-Type: multipart/related; boundary="boundary_tag"
--boundary_tag
Content-Type: application/json; charset=UTF-8
{
"title": "My title"
}
--boundary_tag
Content-Type: image/jpeg
data
--boundary_tag--