manual:api:reference:mediatype:create

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:api:reference:mediatype:create [2014/09/26 11:23]
sasha Links adapted because of a move operation
manual:api:reference:mediatype:create [2019/01/28 14:50] (current)
sasha <code js> => <code java>
Line 24: Line 24:
  
 Request: Request:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 41: Line 41:
  
 Response: Response:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 47: Line 47:
         "​mediatypeids":​ [         "​mediatypeids":​ [
             "​7"​             "​7"​
 +        ]
 +    },
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +=== Creating a media type with custom options ===
 +
 +Create a new script media type with custom value for number of attempts and interval between them.
 +
 +Request:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​method":​ "​mediatype.create",​
 +    "​params":​ {
 +        "​type":​ 1,
 +        "​description":​ "Push notifications",​
 +        "​exec_path":​ "​push-notification.sh",​
 +        "​exec_params":​ "​{ALERT.SENDTO}\n{ALERT.SUBJECT}\n{ALERT.MESSAGE}\n",​
 +        "​maxattempts":​ "​5",​
 +        "​attempt_interval":​ "​11s"​
 +    },
 +    "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​mediatypeids":​ [
 +            "​8"​
         ]         ]
     },     },
Line 55: Line 90:
 ==== Source ==== ==== Source ====
  
-CMediaType::​create() in //​frontends/​php/​api/​classes/​CMediaType.php//​.+CMediaType::​create() in //​frontends/​php/​include/classes/​api/​services/​CMediaType.php//​.