How to call third party site's json api from shopify custom app - json

I created custom app in shopify admin. But I don't know how to call thirdparty site json api with that app. Can anyone help me about this.

In your App, set up the App Proxy. That is an endpoint in your App, GET or POST that you can receive data at. Shopify will call that endpoint with security so you know inside your App the call is a good one. Since you are inside your secure App, this is the place where you can call your third-party API to get data. Once that call completes, you can return JSON to Shopify.
In Shopify theme, the call is /apps/my_end_point with data. Shopify mangles all that, and sends it to your Proxy. So your proxy get data from the front-end, and you can then safely call your APIs, and return JSON to Shopify.
Simple and elegant pattern of use you have to use. There really is no other way to do it securely.

Related

Trigger for status update to send a patch method in Azure DevOps

Have been working on the integration between Azure DevOps Services and ServiceNow. Our goal is to send Change Requests from ServiceNow to Azure DevOps, where they would become Features or User Stories. Whenever there is some update on Azure DevOps, that update should be sent to ServiceNow, and vice versa.
The idea is to work with REST API.
From our investigation, we have found that it is possible to send updates to other applications through Web Hooks. We are still not sure if this will suite our needs and if we are able to work with this. The problem is that the webhooks only support the HTTP method POST while Service Now requests PATCH to update on it’s side. Is this correct is there any way of creating webhooks with PATCH method?
Other way that we can integrate is to create some software that will send response needed. However, we cannot seem to find a way to automate this response. As I understood, it will generate response only when the script run, not when work item is updated. Is there any way to trigger the sending of a json file with all information within the work item whenever the work item state is updated?
As a workaround, you can try to create a custom service hook. Here is the document you can refer to .
Marketplace provides an extension(Azure DevOps Service Hooks DSL) . This extension framework is designed to ease the development of your own REST Web Hook web site to do this type of integration. It does this by providing a MVC WebAPI endpoint and a collection of helper methods, implemented as an extensible Domain Specific Language (DSL), for common processing steps and API operations such as calling back to the TFS/VSTS server that called the endpoint or accessing SMTP services.
Is there any way to trigger the sending of a json file with all
information within the work item whenever the work item state is
updated?
I am not sure if it is possible to trigger that.
But there is a ServiceNow DevOps extension for the integration between Azure Devops and Snow. You may use that.

How to create Flutter chat app with PHP Mysql rest api?

I want to create a chat app in Flutter but all chat data need to store on my server Mysql via PHP API as backend. (I do not want Firebase Firestore or Realtime database)
As many people create chat app on the web via the help of JavaScript, jQuery & Ajax but I don't know how I will use this on Flutter.
You can create your database with MySQL, and your backend API with php. For the backend you can use SLIM or Laravel or any other php framework. Then in your flutter code you will need to make http requests to this API.
A problem that you can face is Realtime because streams in flutter do not make the data retrieval realtime from a php API. To solve this you will need to add a timer that periodically refreshes the chat. A better solution is to use sockets to make the chat realtime. You can also use firebase cloud messaging for notifications which is free of charge.
This might be useful for you:
https://www.youtube.com/watch?v=6vOIk2-WoxQ&list=PL_5DleQzXnX4GRhKef32CiSs2oBfTVxe3

Combining Google Cloud Endpoint and Google Cloud Messaging

I have two things. A backend running on App Engine and a Android app. These needs to communicate in a efficient way.
What I already did. I created a api with Google Cloud Endpoints. This endpoint exposes calls. The objects in the backend are mapped to json and mapped back to objects in the Android app. This is what the Endpoints provide.
Sometimes I want to push information from the backend to the Android app. What I do now is I send a Google Cloud Message (GCM) to the Android app and these is updating everything by calling something on the Endpoint of the backend.
This situation is working without problems but it has some drawbacks:
When I update a lot of devices at ones (what is happening a lot in my application) all those devices make a call to the backend and creating a large peak load.
The extra call is using additional battery on the phones.
What I want is to add the updated information into the GCM. GCM has support to add 4kB of data. Large enough to add the json with the updated information. If I want to send more then 4kB I can always use the old situation.
So, basicly what I want is the following:
When I'm going to send a GCM I retrieve the the correct objects from datastore/database.
Those objects needs to be converted to json in the same way as the Endpoint library does.
The json should be added to the GCM.
In the Android application the json should be convert back to objects in the same way as the Endpoint library does.
Continue processing those object the same way as before.
I found a thread that suggested that I should the gson library to do this. But I have problems in both backend and Android app. And also the json itself is not the same. I want to use the Endpoint library to serialize the same json and to deserialize to the same result as a Endpoint call.
Does anybody have any idea how to do that? Maybe a example or tutorial?

How to provide application-wide authorization to HTTP JSON API for consume it within the browser?

I'm currently working in HTTP JSON API for a touristic webapp. The webapp will be developed by a third-party company and it'll consume the API within the browser.
So I need for the API some sort of authentication to the third-party webapp can consume it. I've been researching a little bit about OAuth, but with this, I have a solution for a user-wide but not for application-wide authorization.
Because the webapp will consume the API within the browser(with Ajax), I'm concerned they will have to put the credentials to consume the API in the user browser.
Another solution would be place the credentials for the API in the server-side, but this don't depend on me.
You could always use something similar to google's method, with a client ID and then a private key used to generate a signature.
https://developers.google.com/maps/documentation/business/webservices#generating_valid_signatures
That page has some code samples as well.

Consume JSON in body of POST Request from ASP.NET

I need to be able to consume some JSON data in a POST request from another web app. I have tried looking at the various methods on the Request class, but nothing seems to give me the JSON I need.
Using Request.Form will not work, since it is not coming from a form, but another web app. The content type is application/json, and from examining the whole HTTP request, I know the JSON is in there. What is the best way to get at this JSON data?
Note: I am working from within an action on a controller.
I think you can get your JSON from your model parameter inside the Action of the Controller. Check out this article that explains a bit of what I mean.
You can also read this one for reference
Since you are consuming data from another web app I would use a REST web service instead of a controller in an MVC application. You cans use the ASP.NET Web API which makes it easy to setup a REST web API and it is tightly integrated in with MVC 4, which is now in Beta. If the communication is cross domain (i.e. different servers and/or ports) you will need to use JSONP. You can go to this StackOverflow QA for directions on how to use JSONP with Web API.