Test

Instructions

BEFORE USING THE API

1) Make the call api/key to get your unique identifier throughout all your entities

2) You need to supply a unique taht unique Id which will help you retrieve your entities.

We will show only sample request and response for the entity Article.

This API is very generic and you can use it for free, saving compute and storage fees.

You have fundamental entities : articles, profiles, settings, logs and visitors.

Use custom fields to add your own properties.

Use the main entity Article to simulate new classes by doing api/id?myclassname/categoryfilter/status

Use of illegal and adult content is not allowed.


Example of uploading a picture using VueJs :

        -script-
            import axios from "axios";
            export default {
                name: 'app',
                data() {
                    return {
                        files: new FormData()
                    }
                },
                methods: {
                    fileChange(fileList) {
                        this.files.append("file", fileList[0], fileList[0].name);
                    },
                    upload() {
                        axios({ method: "POST", "url": "http://mekonecampusapi.azurewebsites.net/api/pictures", "data": this.files }).then(result => {
                            console.dir(result.data);
                        }, error => {
                            console.error(error);
                        });
                    }
                }
            }
        -script-
    

GET

api/Articles/{id}?category={category}&status={status}

Example of API call with Java

    public static Article CallMekone() throws IOException {
        try {
            arto = articles.get(count);
            arto.LikesNumber += 1;
            URL url = new URL("http://mekonecampusapi.azurewebsites.net/api/Articles");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("PUT");
            conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
            ObjectMapper mapper = new ObjectMapper();
            String input = mapper.writeValueAsString(arto);
            OutputStream os = conn.getOutputStream();
            os.write(input.getBytes());
            os.write(input.getBytes("UTF-8"));
            os.flush();

            if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
                throw new RuntimeException("Failed : HTTP error code : "
                        + conn.getResponseCode());
            }
            BufferedReader br = new BufferedReader(new InputStreamReader(
                    (conn.getInputStream())));
            String output;
            //System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                arto = mapper.readValue(output, new TypeReference<Article>() {});
            }
            conn.disconnect();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return arto;
    }
    

POST

        {
          "Title": "sample string 1",
          "Author": "sample string 2",
          "PicUrl": "sample string 3",
          "ViewsNumber": 4,
          "LikesNumber": 5,
          "DateCreated": "sample string 6",
          "Category": "sample string 7",
          "Status": "sample string 8",
          "PartitionKey": "sample string 9",
          "RowKey": "sample string 10",
          "Timestamp": "2018-12-06T04:10:29.1813927+00:00",
          "ETag": "sample string 12"
        }
    

PUT

        {
          "Title": "sample string 1",
          "Author": "sample string 2",
          "PicUrl": "sample string 3",
          "ViewsNumber": 4,
          "LikesNumber": 5,
          "DateCreated": "sample string 6",
          "Category": "sample string 7",
          "Status": "sample string 8",
          "PartitionKey": "sample string 9",
          "RowKey": "sample string 10",
          "Timestamp": "2018-12-06T04:10:29.1813927+00:00",
          "ETag": "sample string 12"
        }
    

Example of Java PUT API call

public static Article CallMekone2() throws IOException {
        try {
            arto = articles.get(count);
            arto.ViewsNumber += 1;
            URL url = new URL("http://mekonecampusapi.azurewebsites.net/api/Articles");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("PUT");
            conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
            ObjectMapper mapper = new ObjectMapper();
            String input = mapper.writeValueAsString(arto);
            OutputStream os = conn.getOutputStream();
            os.write(input.getBytes());
            os.write(input.getBytes("UTF-8"));
            os.flush();

            if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
                throw new RuntimeException("Failed : HTTP error code : "
                        + conn.getResponseCode());
            }
            BufferedReader br = new BufferedReader(new InputStreamReader(
                    (conn.getInputStream())));
            String output;
            //System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                arto = mapper.readValue(output, new TypeReference<Article>() {});
            }
            conn.disconnect();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return arto;
    }
    

DELETE

http://www.mekonetolrom.com/api/articles/{id}?rubrique={rubrique}

ISSUES

Issues will be recorded here! Contact us at info@mekonecampus.org

Dcoumentation and tests are not complete yet.