I have the following output from a POST response on data dog. I want to parse the data into json
[01/Sep/2022:20:01:23 +0000] 209.66.98.242 10.0.0.126- POST /mobile/v1/refresh-token HTTP/1.1 200 1366 Dart/2.17 (dart:io) [0.030 s] 5466336 {\x22fcmToken\x22:\x22ccl1oR3wBEYmqvzQsvLDR2:APA91bHCnWMsMkvzJaHYGE5sM9MLWgZp6loSibedJ3BQGMw_bVjxfNFaZWqC24pwvWWfxwmwjlpjOjxCCOYYpWeRGIPlir8ACJ2ONfULBGIvD4pm9GqF04uRFk-oRv2gnbbfU3Pwr9gM\x22,\x22deviceId\x22:\x2234DC3590-8496-4622-8C5F-BF3DCBDEC7BA\x22,\x22deviceInfo\x22:{\x22deviceModel\x22:\x22iPhone\x22,\x22deviceManufacturer\x22:\x22apple\x22,\x22deviceId\x22:\x2234DC3590-8496-4622-8C5F-BF3DCBDEC7BA\x22,\x22deviceOsVersion\x22:\x2215.6.1\x22,\x22deviceName\x22:\x22iPhone14,2\x22},\x22token\x22:\x22eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHBpcmVkQXQiOjE2Njk4MjU1Njk4OTAsImlzTW9iaWxlIjoidHJ1ZSIsImVtYWlsIjoiaXNhYmVsbGVsaXUuOTg3QGdtYWlsLmNvbSIsImlkIjo0MDg2Mjh9.GppZmdhEvatc6ttWV6wLQEuddB75TEOhcQMUpoaf2cw\x22,\x22provider\x22:\x22google\x22,\x22os\x22:\x22ios\x22,\x22version\x22:\x224.1.81\x22}
Here is what i have so far for the rule:
autoFilledRule3 \[%{date("dd/MMM/yyyy:HH:mm:ss Z"):date}\]\s+%{ipv4:network.client.ip}\s+%{ipv4:network.client.ip_1}-\s+%{word:http.method}\s+%{notSpace:http.url}\s+HTTP%{notSpace:http.url_1}\s+%{integer:http.status_code}\s+%{integer:token_1}\s+akka-http%{notSpace:http.url_2}\s+\[%{number:token_2}\s+s\]\s+%{integer:token_3}\s+-
I have managed to parse everything except the information in between the last {}. the keys and data are surrounded by \x22
Cant manage to retrieve this information
Related
Need some help with Jmeter .
Environment: Apache Jmeter 5.0 , Java 1.8, Mac OS High Sierra 10.13.6
Problem outline:- Post call not getting 302 response with Location header(redirect) instead get 200 response without Location header
The problem here is in Jmeter but same works in Postman. In a Jmeter thread group I have cookie manager and couple of Get and Post calls. I set to save the cookie in user.properties file.
Scenario:- Login
1) first do GET ( call with some query parameters) / login endpoint will give response cookie and csrf-token with 200 then next
2) next do POST with form data ( in xxxform url encoded with csrf-token from get response ) + Cookie from get response from at / login endpoint should return 302 with token is the expected result but getting 200 instead with no redirection in Jmeter. In Postman able to get the desired results.
When the same is replicated in Jmeter with same setting as performed in Postman results are not as expected
Errors in Jmeter are:- 404 with location header missing or 200 with no Location response header
But not 302 with Location response header
With how many different combinations attempted.
Attached my sample TestPlans and Post request. Have also tried to place form data in Body instead in Parameters tab but have the same result.
Thanking in advance! Appreciate anyone who could share their thoughts and rescue from this current issue.
So I'm fairly new to creating API documentation and I'm having some difficulty creating a new entry via the swagger UI. I keep getting a 405 response. I have no idea what the issue is, I've become code blind. The link to the API is below. Any pointers would be greatly appreciated.
https://swaggerhub.com/apis/Sharper-Web-Dev/test/1.0.0
Your definition specifies SwaggerHub's mock server (virtserver.swaggerhub.com) as the target server. The mock server generates the responses based on the responses defined in your API definition. POST /charity defines just the 405 response, that's why the mock returns 405.
To get a "normal" response, you need to define a 200 OK or 201 Created response, and add the response schema (or response examples) describing the desired JSON structure.
paths:
/charity:
post:
...
produces:
- application/json
parameters:
...
responses:
200:
description: OK
schema:
$ref: "#/definitions/MyResponseSchema"
405:
description: "Invalid input"
See How Response Mocking Works in SwaggerHub docs for further information.
I'm hoping I can get some help with adding news the D2L. I've tried a lot and have gotten to the point where I don't know what else to try.
The error I keep on getting is 404. So, I'm thinking that either something is wrong with the URL I'm trying, or the data I'm sending (or maybe content type that is being sent).
I saw that when adding news, you need to pass it a multipart/mixed POST body. So, I've tried changing my code to include that, but I'm still not sure what is going on.
I don't think it's a permissions thing because I'm supposed to have full access with this account (and it's not 403, but 404)
This is the data I'm trying to send.
Overall Content Type:
ContentType: multipart/mixed;boundary=6da451c7
Data Being Sent:
--6da451c7
Content-Type: application/json
{"Title":"Test News Title","Body":{"Text":"Testing Testing 123...Testing Testing","Html":"<p>Testing Testing 123...Testing Testing</p>"},"StartDate":"2013-11-17T20:07:11Z","EndDate":"2013-12-02T20:07:11Z","IsGlobal":false,"IsPublished":false,"ShowOnlyInCourseOfferings":false}
--6da451c7
And here is the URL i'm trying to POST data to (slightly modified to not include personal data).
https://gsutest.desire2learn.com/d2l/api/le/1.3/6606/news/?x_a={{TOKEN}}&x_b={{TOKEN}}&x_c={{TOKEN}}&x_d={{TOKEN}}&x_t={{TIMESTAMP}}
I'm not sure where to go from here, any help would be nice. I realize I could be creating my POST body data wrong, but I'm just not sure what to try.
Thanks!
----Edit----
Ran a POST using fiddler and captured this data
POST https://gsutest.desire2learn.com/d2l/api/le/1.3/6606/news?x_a={{APPID}}&x_b={{USERID}}&x_c=OR0KIlHnHChrBvhHT99HVkH4WrD9dw_uPlpTGzKOdXc&x_d=b_TmyIHdTOL3U5bkNa1UNn11S4Yg7Cc3GOBoI911gLE&x_t={{TIMESTAMP}} HTTP/1.1
Content-Type: multipart/mixed;boundary=1649e26b
Host: gsutest.desire2learn.com
Content-Length: 342
Expect: 100-continue
Connection: Keep-Alive
--1649e26b
Content-Type: application/json
{"Title":"Test News Title","Body":{"Text":"Testing Testing 123...Testing Testing","Html":"<p>Testing Testing 123...Testing Testing</p>"},"StartDate":"2013-11-19T21:07:03.838Z","EndDate":"2013-12-04T21:07:01.413Z","IsGlobal":false,"IsPublished":false,"ShowOnlyInCourseOfferings":false}
--1649e26b
----Edit #2----
Ran another POST using fiddler and captured this data. The data that I'm sending came from: http://docs.valence.desire2learn.com/basic/fileupload.html#simple-uploads (under the upload to news section)
POST https://gsutest.desire2learn.com:443/d2l/api/le/1.3/6606/news/?x_a={{APP_ID}}&x_b={{USER_ID}}&x_c=rdzAFVUE6xBS24N5nE_4Hf5sbwpvJH1OVJaK4Ow-XT8&x_d=TmadrEGw55aKwS1uuNo68kvaR_pvYLUWJdsFa7LhrEQ&x_t={{TIMESTAMP}}" HTTP/1.1
Content-Type: multipart/mixed;boundary=xxBOUNDARYxx
Host: gsutest.desire2learn.com:443
Content-Length: 270
--xxBOUNDARYxx
Content-Type: application/json
{"EndDate": null, "IsPublished": false, "ShowOnlyInCourseOfferings": false,"Title": "Test title", "Body": {"Text": "Test body text", "HTML": null},"StartDate": "2013-02-20T13:15:30.067Z", "IsGlobal": false}
--xxBOUNDARYxx
I'm still getting "HTTP/1.1 404 Not Found" as the response headers.
Using the data you provided, I discovered that you are missing the millisecond value in your UTCDateTime format. By adding a millisecond value of .067 and .068 to each of the dates, I am able to POST successfully. I did this by using the Getting Started Sample against an LMS where I have an Instructor account with privileges to POST News items.
I'm trying to POST the following data to a Rails server (running on WebRick) from Android.
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<data>
<email>email.test#name.com</email>
<password>APassw0rd</password>
<remember_me>1</remember_me>
</data>
Now, the funny thing is that these data never show up in the params field in the controller.
Webrick does not output any parsing error. (And I guess it would post an error if it received a POST with no data attached:
Started POST "/users/sign_in.xml" for 192.168.1.94 at 2012-12-14 17:33:20 +0100
Processing by Users::SessionController#create as XML
Completed 500 Internal Server Error in 22643ms
I also found no trace of the data in the request.env variable. Actually, I see no HTTP_BODY in the dump fields. How can one see the raw body of the request? Would webrick really not complain if it received a POST with no attached data?
request.env would show the data as an IO object so you wouldn't be able to see your xml directly.
request.raw_post should return the raw data.
For rails to try and parse your xml into the params hash directly you need to set the content type of the request to application/xml. The 'processing as xml' stuff means that rails will try to render an xml response and doesn't necessarily have any bearing on the format of the posted data
I've managed to get an adaptive payments script to work in the apigee console, here is the request:
X-PAYPAL-REQUEST-DATA-FORMAT: JSON
X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T
X-HostCommonName: svcs.sandbox.paypal.com
Host: svcs.sandbox.paypal.com
Content-Length: 428
X-PAYPAL-DEVICE-IPADDRESS: 127.0.0.1
X-Forwarded-For: 10.203.10.109
X-PAYPAL-REQUEST-SOURCE: APIGEE-CONSOLE-1.0
X-Target-URI: https://svcs.sandbox.paypal.com
X-PAYPAL-RESPONSE-DATA-FORMAT: JSON
Content-Type: text/plain; charset=ISO-8859-1
Connection: Keep-Alive
"{
"actionType":"PAY",
"currencyCode":"USD",
"receiverList":{"receiver":[{"amount":"5.00","email":"cam_1315509411_per#btinternet.com"}]},
"returnUrl":"http://apigee.com/console/-1/handlePaypalReturn",
"senderEmail":"qwom_1315508825_biz#btinternet.com",
"feesPayer":"SENDER",
"cancelUrl":"http://apigee.com/console/-1/handlePaypalCancel?",
"requestEnvelope":{"errorLanguage":"en_US", "detailLevel":"ReturnAll"}
}"
How do I actually post this information to the https://svcs.sandbox.paypal.com/AdaptivePayments/Pay url? I can't find the easiest way to do it, should I use cURL and what are the variables names for each post value?
That depends on the rest of your application. PHP with cURL is fairly straightforward, but it's not too much of a hassle in other languages either.
PayPal has sample code online at https://www.x.com/developers/PayPal/documentation-tools/code-sample/78
If you were to do this yourself, you'd need to (in a nutshell):
- Send a proper HTTP header with the X- headers as shown above including the application ID.
- Send the API call via JSON, SOAP or NVP as POST or GET to the API endpoint
- Decode the response and act accordingly