Skip to content

Instantly share code, notes, and snippets.

View petyagrill's full-sized avatar
💪
working

Petro Holovatyi petyagrill

💪
working
View GitHub Profile

Mono Corp API Proxy Protocol

This document describes the protocol of Mono Corp API Proxy (MCAP). This protocol is created for Mono PWA project.

Entities

  • Root: describes the publicly available URL path, which contains methods as subfolders;
  • Method: Named public command, the way to interact with MCAP for different actions. A simulated subfolder of Root;
  • Response: JSON marshaled output of Method with application/json Content-Type and 200 OK response code;
  • Error: A Response with an error key instead of the expected output. The key contains error description -> {"error": "description"};
  • Long-Polling: Keeping an HTTP request alive without outputting the response body until a trigger;
  • %METHOD% /%resource% Monobank Request: An HTTP %METHOD% (GET|POST|...) request to https://api.monobank.ua/%resource% -> POST /personal/auth/request Monobank Request. See Sending requests to Monobank;
@petyagrill
petyagrill / webp_minishop2.php
Created March 14, 2019 03:11
webp minishop2
<?php
foreach (['upload_files','upload_images'] as $option){
if($setting = $modx->getObject('modSystemSetting',['key'=>$option])){
$extensions = explode(',',$setting->get('value'));
if(!in_array('webp',$extensions)){
$extensions[] = 'webp';
$setting->set('value',implode(',',$extensions));
$setting->save();
}
}