如何使用Appgyver Composer配置Magento API?

时间:2016-03-22 03:25:52

标签: android ios api magento

我有兴趣创建一个连接到我的magento商店的Android和ios的移动应用程序。

我目前正在使用appgyver composer来执行此操作,但我无法使用appgyver正确配置magento API以接收和发送与magento商店之间的数据。有人能告诉我将magento REST API与appgyver composer集成的过程吗?

2 个答案:

答案 0 :(得分:0)

使用Postman应用程序查看生成的代码Magento API并将其与Appgyver API示例进行比较后,我意识到格式不同。幸运的是,我在Github上遇到了针对Magento的REST API扩展,它扩展了Magento的REST API功能,并提供了我需要的格式。你找不到它here

然后我可以轻松使用Appgyver Composer REST API配置页面将Magento链接到我想要创建的应用程序。

答案 1 :(得分:0)

How to integrate magento api, It's getting 500 error but it working on postman, we request volley get request and put parameter in url and header also but it still not working....pls help me

RequestQueue requestQueue = Volley.newRequestQueue(HomeProductActivity.this);
        JsonObjectRequest getRequest = new JsonObjectRequest(Request.Method.GET, "http://128.199.158.123/Devtest/api/rest/categories/?oauth_consumer_key=87fb627751a50a2666e9c4501a4bc85f&oauth_token=f4cb9148deb67e05a3531e05b9edf923&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1501669923&oauth_nonce=VcTJZa&oauth_version=1.0&oauth_signature=xIrlLY0D1CGXkD49OduVqZhIVec=", "",
                new Response.Listener<JSONObject>() {
                    @Override
                    public void onResponse(JSONObject response) {
                        // display response
                        Log.d("Response", response.toString());
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Log.d("Error.Response", "hfjf");
                    }
                }) {
            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                final Map<String, String> headers = new HashMap<>();
                headers.put("Authorization", "OAuth oauth_consumer_key=\"87fb627751a50a2666e9c4501a4bc85f\",oauth_token=\"f4cb9148deb67e05a3531e05b9edf923\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\"1501750716\",oauth_nonce=\"Imh2HF\",oauth_version=\"1.0\",oauth_signature=\"b%2F5UoepFy6QL7oFDBMAh9ij0yGM%3D\"");
                return headers;
            }
        };
        getRequest.setRetryPolicy(new DefaultRetryPolicy(80000,
                DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
                DefaultRetryPolicy.DEFAULT_TIMEOUT_MS));
        requestQueue.add(getRequest);
        requestQueue.add(getRequest);