Meride API - Presentation - Formats

JSON

The Meride API are available in the JSON format.

When creating a request, the following parameter must be specified in the Header Accept: application/json

In addition, you will need to add the desired format to the URL again, in this case json instead of {format}

GET http://API_DOMAIN/rest/v2/{resource}.{format}

Passing POST and PUT parameters

The Meride API accepts the passing of the POST and PUT parameters in different formats that we can briefly demonstrate

application/x-www-form-urlencoded

Example of a curl call:

curl -i -H "Accept: application/json" -H "access-token: [your-access-token]" -X POST http://API_DOMAIN/rest/v2/live.json -d 'title=my title&source_url=http://www.streaming.com/live.f4m'
		


application/json

Example of a curl call:

curl -i -H "Accept: application/json" -H "Content-Type:application/json" -H "access-token: [your-access-token]" -X POST http://API_DOMAIN/rest/v2/live.json -d '
{
	"title": "Live title",
	"source_url": "http://www.streaming.com/live.f4m"
}
'
		


multipart/form-data

To be used for passing multimedia files
Example of a curl call:

curl -i -H "Accept: application/json" -H "access-token: Fun94nBf4YiaL20hG5np2Ki8mHtm9OCn4R6lPamNM8mNn7YFDRUvZveSbB0n6T" -X POST -F "preview_image=@path_and_filename.jpg" -F "title=Live title" -F "source_url=http://www.streaming.com/live.f4m" http://API_DOMAIN/rest/v2/live.json
		
When it is necessary to send multimedia files in the request but you want to keep the flexibility to send the other parameters in json format, you can proceed as in the following example
curl -i -H "Accept: application/json" -H "access-token: [your-access-token]" -X POST http://API_DOMAIN/rest/v2/live.json -F 'preview_image=@path_and_filename.jpg' -F '_json_body=
{
	"title": "Live title",
	"source_url": "http://www.streaming.com/live.f4m"
}
'
		

Note Note the assignment of the json object to the special variable _json_body