Send Data by Using a POST Method (2024)

Open topic with navigation

You can send files and binary data directly to Media Server using a POST request. One possible way to send a POST request over a socket to Media Server is using the cURL command-line tool.

The data that you send in a POST request must adhere to specific formatting requirements. You can send only the following content types in a POST request to Media Server:

  • application/x-www-form-urlencoded
  • multipart/form-data

TIP:

Media Server rejects POST requests larger than the size specified by the configuration parameter MaxFileUploadSize.

Application/x-www-form-urlencoded

The application/x-www-form-urlencoded content type describes form data that is sent in a single block in the HTTP message body. Unlike the query part of the URL in a GET request, the length of the data is unrestricted. However, Media Server rejects requests that exceed the size specified by the configuration parameter MaxFileUploadSize.

This content type is inefficient for sending large quantities of binary data or text containing non-ASCII characters, and does not allow you to upload files. For these purposes, Micro Focus recommends sending data as multipart/form-data (see Multipart/form-data).

In the request:

  • Separate each parameter from its value with an equals symbol (=).
  • Separate multiple values with a comma (,).
  • Separate each parameter-value pair with an ampersand (&).
  • Base-64 encode any binary data.
  • URL encode all non-alphanumeric characters, including those in base-64 encoded data.

Example

The following example base-64 encodes the file image.jpg into a file imagedata.dat and sends it (using cURL) as application/x-www-form-urlencoded data to Media Server located on the localhost, using port 14000. The example action adds the image to a new face in an existing face database named politicians.

  1. Base-64 encode the image.

    • On Windows, create a Powershell script called base64encode.ps1 that contains the following:

      Param([String]$path)[convert]::ToBase64String((get-content $path -encoding byte))

      Then from the command line, run the script using Powershell:

      powershell.exe base64encode.ps1 image.jpg > imagedata.dat
    • On Linux:

      base64 -w 0 image.jpg > imagedata.dat
  2. Send the request to Media Server:

    curl http://localhost:14000 -d 'action=TrainFace&database=politicians&identifier=president' --data-urlencode [email protected]

You can send multiple images in a single request by separating the binary data for each image by a comma (in imagedata.dat).

Multipart/form-data

In the multipart/form-data content type, the HTTP message body is divided into parts, each containing a discrete section of data.

Each message part requires a header containing information about the data in the part. Each part can contain a different content type; for example, text/plain, image/png, image/gif, or multipart/mixed. If a parameter specifies multiple files, you must specify the multipart/mixed content type in the part header.

Encoding is optional for each message part. The message part header must specify any encoding other than the default (7BIT).

Multipart/form-data is ideal for sending non-ASCII or binary data, and is the only content type that allows you to upload files. For more information about form data, see http://www.w3.org/TR/html401/interact/forms.html.

NOTE:

In cURL, you specify each message part using the -F (or --form) option. To upload a file in a message part, prefix the file name with the @ symbol. For more information on cURL syntax, see the cURL documentation.

Example

The following example sends image.jpg (using cURL) as multipart/form-data to Media Server located on the localhost, using port 14000. The example action adds the image to a new face in an existing face database named politicians.

curl http://localhost:14000 -F action=TrainFace –F database=politicians –F identifier=president –F [email protected]

© 2018Micro Focus or one of its affiliates

Send documentation feedback to Micro Focus

_FT_HTML5_bannerTitle.htm
Send Data by Using a POST Method (2024)
Top Articles
The Top Benefits of TRX Suspension Training
4 Best Tether USDT Wallets For Various Purposes (2023 Edition)
What Did Bimbo Airhead Reply When Asked
This website is unavailable in your location. – WSB-TV Channel 2 - Atlanta
Robot or human?
My Boyfriend Has No Money And I Pay For Everything
Wausau Marketplace
Co Parts Mn
Tap Tap Run Coupon Codes
Khatrimaza Movies
MADRID BALANZA, MªJ., y VIZCAÍNO SÁNCHEZ, J., 2008, "Collares de época bizantina procedentes de la necrópolis oriental de Carthago Spartaria", Verdolay, nº10, p.173-196.
Kagtwt
Lqse-2Hdc-D
Herbalism Guide Tbc
Slag bij Plataeae tussen de Grieken en de Perzen
Johnston v. State, 2023 MT 20
Trini Sandwich Crossword Clue
7440 Dean Martin Dr Suite 204 Directions
979-200-6466
Nail Salon Goodman Plaza
Invert Clipping Mask Illustrator
Free Online Games on CrazyGames | Play Now!
Why Is 365 Market Troy Mi On My Bank Statement
UPS Store #5038, The
Crawlers List Chicago
Vegito Clothes Xenoverse 2
Titanic Soap2Day
Baja Boats For Sale On Craigslist
Wics News Springfield Il
Kimoriiii Fansly
Ticket To Paradise Showtimes Near Cinemark Mall Del Norte
8002905511
Pdx Weather Noaa
Microsoftlicentiespecialist.nl - Microcenter - ICT voor het MKB
Cheap Motorcycles Craigslist
Carespot Ocoee Photos
Samsung 9C8
Eleceed Mangaowl
Edict Of Force Poe
Heelyqutii
About :: Town Of Saugerties
Mcgiftcardmall.con
Section 212 at MetLife Stadium
Gt500 Forums
Gon Deer Forum
Caesars Rewards Loyalty Program Review [Previously Total Rewards]
New Zero Turn Mowers For Sale Near Me
552 Bus Schedule To Atlantic City
Pelican Denville Nj
Ciara Rose Scalia-Hirschman
Scholar Dollar Nmsu
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 6087

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.