Media Service to POST binaries:
An out-of-band operation is required to post media binaries to a service. On success this service will respond with the required attributes that include the location uri and media key to post the media entities to the web api along with the listing entity.
Command
POST http://uploads.crmls.org/api/mediaupload
Http Request Headers
Content-Type: multipart/form-data; boundary=-----------------------acebdf13572468
Host: uploads.crmls.org
Authorization: Bearer 82fa1d6c48c6dcd3de033549519deae2
Content-Length: 782556
Http Body Payload
-----------------------------acebdf13572468
<Binary data base64 encoded>
-----------------------------acebdf13572468
<Binary data base64 encoded>
-----------------------------acebdf13572468--
Output Response Headers
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 04 Sep 2019 00:17:22 GMT
Content-Length: 398
Output Response Body
[
{
"Id": "89a4d0a9-56fc-49f9-a93d-0c9a797c0e8a",
"FileName": "imagename1.jpeg",
"Location": "http://staging.media.crmls.org/medias/89a4d0a9-56fc-49f9-a93d-0c9a797c0e8a.jpeg",
"MediaType": "image/jpeg",
"Size": 538
},
{
"Id": "e6958b39-48a9-4210-8dfb-e4610acc3938",
"FileName": "imagename2.jpg",
"Location": "http://staging.media.crmls.org/medias/e6958b39-48a9-4210-8dfb-e4610acc3938.jpg",
"MediaType": "image/jpeg",
"Size": 34
}
]
Additional Information
You will use this payload from the media upload service to perform your deep insert for a listing with the media entities embedded.
{
"@odata.type":"#OData.Models.Property",
"AverageStudioAreaUnits": null,
"BackOnMarketDate": null,
"BathroomsFull": 4,
...
"WellReportYN": null,
"WindowFeatures": "DPW,TIN,CWC",
"WorkmansCompensationExpense": null,
"YearBuilt": 2008,
"YearBuiltSource": "ASS",
"YearEstablished": null,
"YearsCurrentOwner": null,
"Zoning": "R1",
"ZoningDescription": null,
"ListAgentLanguages_1": "AA,AM,HY",
"ListAgentLanguages_2": "IW,IB",
"ListAgentLanguages_3": "QU",
"PropertyType": "Resi",
"Media":
[
{
"@odata.type": "#OData.Models.Media",
"ClassName": " _2",
"MediaKey": "89a4d0a9-56fc-49f9-a93d-0c9a797c0e8a",
"OriginatingSystemMediaKey": ,
"MediaURL": "http://staging.media.crmls.org/medias/89a4d0a9-56fc-49f9-a93d-0c9a797c0e8a.jpeg",
"Order": 0,
"MediaObjectID": "imagename1.jpeg",
"ResourceName": "_1",
"MediaType": "IMAGE",
"ModificationTimestamp": "2018-04-21T20:35:53.590-0700",
"MediaModificationTimestamp": "2018-04-21T20:35:53.590-0700",
"DeletedYN": false,
"OriginatingSystemID": "CRM",
"MemberAOR": "",
"OfficeMlsId": "",
"ChangedByMemberID": "",
"ShortDescription": "Short Description",
"ImageOf": "",
"Approved": true,
"FileSize": 1024
},
{
"@odata.type": "#OData.Models.Media",
"ClassName": " _2",
"MediaKey": "e6958b39-48a9-4210-8dfb-e4610acc3938",
"OriginatingSystemMediaKey": ,
"MediaURL": "http://staging.media.crmls.org/medias/e6958b39-48a9-4210-8dfb-e4610acc3938.jpg",
"Order": 0,
"MediaObjectID": "imagename2.jpeg",
"ResourceName": "_1",
"MediaType": "IMAGE",
"ModificationTimestamp": "2018-04-21T20:35:53.590-0700",
"MediaModificationTimestamp": "2018-04-21T20:35:53.590-0700",
"DeletedYN": false,
"OriginatingSystemID": "CRM",
"MemberAOR": "",
"OfficeMlsId": "",
"ChangedByMemberID": "",
"ShortDescription": "Short Description",
"ImageOf": "",
"Approved": true,
"FileSize": 1024
}
]
Referencess
- Media binary upload service: http://uploads.crmls.org/api/mediaupload
- Testing MediaAPI - http://uploads.crmls.org - using the same clientId and secret usd for the web api
- Posting to this endpoint is in a multipart/form-data type of post