Description
This document describes the mechanism through which resource upload operations can be performed using the MGB Rest service.
Service location
For resource upload operations you must use the URL bellow (which is different to the URL for the non upload operations):
http://mgbapi.mygeobook.com/MgbRest/PublicResourcesApi.svc
Call architecture
While resource upload operations use a REST like architecture as well as all the other methods from the MGB Rest service, their anatomy is different since they need to be optimized for binary data transfers.
All resource upload calls are made using HTTP POST calls. All successful methods return a HTTP status code of 200. All resources must use the following HTTP header:
CONTENT-TYPE: application/octet-stream
A resource upload method is composed out of three parts:
method_name parameters resource_binary_data
The method name is a relative URL that is added to the service location. For example:
http://mgbapi.mygeobook.com/MgbCore/CoreResourcesAPI.svc/profile/uploadIcon
In the above location the method name is /profile/uploadIcon. All parameters to the method are added as URL parameters after the method name. All parameters must be url encoded. For example:
http://mgbapi.mygeobook.com/MgbCore/CoreResourcesAPI.svc/profile/uploadIcon? requestingUserId=1234&profileId=4321
Please note that there is major difference between passing parameters to resource upload methods (parameters passed on the URL) compared to the standard service methods (parameters passed inside the method body).
The resource to upload will be passed as a binary string in the body of the HTTP POST request.
Method reference
Methods
Method name: /profile/uploadIcon
Parameters:
• appKey
• sessionId
• callId
• sig
• profileId
Method name: /profile/uploadThumbnail
Parameters:
• appKey
• sessionId
• callId
• sig
• profileId
Method name: /pointOfInterest/uploadThumbnail
Parameters:
• appKey
• sessionId
• callId
• sig
• poiId
Method name: /pointOfInterest/uploadImage
Parameters:
• appKey
• sessionId
• callId
• sig
• poiId
• title [optional] – represents the title of the picture (this can also be updated later)
• description [optional] – represents the description of the picture (this can also be updated later)
Returns: the id of the newly created image
Service call example
HTTP Method: POST
URL: http://mgbapi.mygeobook.com/MgbRest/PublicResourcesApi.svc/pointOfInterest/uploadImage?appKey=dc630623027e45aaa135e95bce506573&sessionId=62ea37c4ba0345769d6ab57b52fc1343&callId=633927168854181553&sig=649025dca3ce9e5fef06bae7969e7009&poiId=2&title=Public+title&description=Public+description
Headers:
Content-Type: application/octet-stream
Body:
[binary data of the file to upload]