Created
March 13, 2019 06:22
-
-
Save george-i/6f20d9cb05873d718a1e689885da0c78 to your computer and use it in GitHub Desktop.
Create Warp @ kiwi (Java)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OkHttpClient client = new OkHttpClient(); | |
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"); | |
RequestBody body = RequestBody.create(mediaType, "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nBreakup Party\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"location\"\r\n\r\nIcecream Factory\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"group_type\"\r\n\r\nPublic\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"start_date\"\r\n\r\n06-23-2019 11:00:00\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"longitude\"\r\n\r\n-74.0059728\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"latitude\"\r\n\r\n40.7127753\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"spayc_category_id\"\r\n\r\n160\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"payment_type\"\r\n\r\nFree\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"image\"; filename=\"C:\\path\\to\\file\\icecream.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"end_date\"\r\n\r\n06-24-2019 11:00:00\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nIcecream for everyone\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"); | |
Request request = new Request.Builder() | |
.url("http://spayc-staging.kiwireader.com/api/spaycs.json") | |
.post(body) | |
.addHeader("content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW") | |
.addHeader("TOKEN", "<YOUR_TOKEN>") | |
.addHeader("Content-Type", "application/x-www-form-urlencoded") | |
.addHeader("cache-control", "no-cache") | |
.build(); | |
Response response = client.newCall(request).execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment