How to set up rest server and client.
I read the tutorial https://code.tutsplus.com/tutorials/working-with-restful-services-in-codeigniter--net-8814.
I got idea about restfull services , and rest server work fine , but rest client not.
My problem is I dont get the idea about rest client spark , And the given link CodeIgniter Curl library: http://getsparks.org/packages/curl/show was down , So cant get this.
How do I get this ?
The client mentioned in the post is merely for testing purposes. It is not part of the REST server.
What you need to set up in your code is the REST server library, method of authentication, database tables (if using any), and the controllers that will map your endpoints.
The client concept represents any device/application that will be consuming from or sending data to your REST service through the HTTP methods.
You could be using postman for your testing. It is free and open-source, and very intuitive to use.
Related
I am new to AZURE O365 portal, I have created some users in azure portal.
How can I create API in Azure portal to get the user details which I have already created in the portal and are they users enabled or disabled using PHP.
I tried: I have created application and I created secret Id in the portal, then what I have to do, to generate API for user list using php.
please help on it.
Thanks
Sandeep
Not sure if I undestand you correctly: you created some users on the azure portal and you want to get these users using PHP?
Azure has many APIs, they also have an API for getting these users, here is the specification and example code (not in php, but I think still easy to understand):
https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http
Basically you can access that data using graphql client. There are many graphql libraries for php. But as I skimmed through the docs, you don't really need a library, just a way to create http requests, I recommend Guzzle.
Before you create that php code, I recommend to simply play with the API by using postman or other api client. If it works there, you can start to create the php code.
The code is basically a http POST request (or whatever is specified in the documentation). The request should contain your API tokens in the header, thats all. Data will be provided usually as JSON. Here are some examples how to use guzzle in php for graph.
I'm an experienced data analist with mostly SQL and R experience, little Python, and unfortunately little .NET and PHP exposure. I have searched extensively for anyone with a similar questions, but unfortunately I haven't found what I'm looking for.
Situation: I'm setting up an HDInsight cluster on Azure (with Apache Spark) and I need to pull in some data from a SOAP API (no restful API).
Problem: Where and how do I pull this data in? I thought the Logic App in Azure would be a suitable place. However, I don't quite succeed in calling on this API.
I do have a working PHP script with a proper API call. Here is a (part of) the syntax.
$client = new SoapClient('http://someURL?wsdl');
$webservice = new SoapClient('http://someotherURL?wsdl');
$session = $client->someOperationToLogin($var1, $var2, $var3);
$operation = $webservice->someOperationToGetData($session, $var4, $var5);
$session = $client->logout($session);
As you can see, I first need to obtain a session id and then use this session id in subsequent calls. As far as I understand, I can't get to this data through a simple HTTP request.
Questions:
Can I call this particular SOAP API directly through one of the existing connectors in the Azure Logic App
If (1) is not possible, can I make use of the existing PHP script? How and where?
Is there any other route I can follow to make use of the data through this SOAP API? For instance: using pyspark in the Spark/HDInsight Cluster?
I really appreciate your help and pointers.
You Can Make The Call Through The Normal HTTP Connector.
1- First Set Your Http trigger method to post and send it your xml Body.
HTTP Trigger
2- Make An Http Action with the url to Your Soap End like
abc.asmx
xyz.svc Http Call To Soap End
Don`t forget to set the Method To Post and Content-Type to text/xml as a header.
3- Finally Bind your Http Response to response action set the status code and body To the HTTP Action Status and Body Dynamically don`t forget to set to content type Here to text/xml as well Return Response Action
4- Finally Configure the run After for response component to sun after HttP Action Even If Faild , Cancled or time out Just to pass the Status code for every call Like That Right click on Response and configure run after conf Run After For response Action .
Here is The Full View Full Flow.
Like The Response If This helps.
There are no SOAP APIs called thru the existing connectors in Azure Logic App.
This is a list of Connectors and API Apps Reference: https://msdn.microsoft.com/en-us/library/azure/dn948518.aspx.
Their supported functions are all based on REST APIs via Http/Https.
All services & apis on Azure are almost based on REST APIs to compatible with crossover platform & language scenes.
But even so, you can create own SOAP APIs thru Azure App Service or Cloud Service.Please refer to http://azure.microsoft.com/en-us/documentation/services/app-service/api/ and https://azure.microsoft.com/en-us/documentation/articles/app-service-logic-arm-with-api-app-provision/.
In Azure HDInsight, you can pull in some data from Storage Service and Service Bus. If you want to use Azure Logic App, the exisiting connectors are Blob Connector and ServiceBus Connector, and even Dropbox Connector.
You can refer to the references below to use PHP script to access the Azure Storage & ServiceBus services linked as HDInsight resources to store/get or send/receive some data.
1.https://azure.microsoft.com/en-us/documentation/articles/storage-php-how-to-use-blobs/
2.https://azure.microsoft.com/en-us/documentation/articles/service-bus-php-how-to-use-queues/.
Best Regards.
It is now possible to create a REST API from a SOAP WSDL file through Azure API Management using the SOAP to Rest feature.
This can be accessed from:
Azure portal -> API Management services -> <Your API Management Service> -> APIs -> Add API -> WSDL
After this is set up, it is easy to access this API from other Azure products.
I am developing a new api using rest api php. This API can only operate securely over SSL/TLS. All API requests must be made over HTTPS. Calls made over plain HTTP will fail and the api client must authenticate for all requests. What can we do.
I have used RestServer Controller for this.
A fully RESTful server implementation for CodeIgniter using one library, one config file and one controller.
Here is the link:- https://github.com/chriskacerguis/codeigniter-restserver
Just go through the implementation.
Hope this help.
I'm trying to automate getting(posting) data from SAP CRM using my server (cURL/PHP+MSSQL), but have some problems with it.
There is no access allowed except this web interface.
I tried to use cURL, using POST fields from FireBug, but it returned only logon error.
Questions:
Is there any solution or API?
Has anybody tried it?
Thanks.
Yes, there are APIs, though you'll have to be more specific about exactly what data you want in order to say if a particular API to serve your needs exists. SOAP web services are an option that may provide the information you need and there are PHP SOAP libraries. You'll need to talk to your SAP team to get access to the system, and you will probably want to be much more specific about the exact data you need access to.
If your company has Gateway, you can also define OData APIs. And it is, of course, possible to define your own RESTful (or other) HTTP APIs using SAP's HTTP stack. Again, you'll need to talk to your SAP team about this.
I have an API written in PHP that works by receiving HTTP POST requests, the API will then process the request and output some XML.
I have an Android application that is communicating with this API successfully.
My question is how do I make this secure?
I was looking into using OAuth, but for PHP it uses a library that is not available to me.
Plus as the API is not public and only to be used by external applications created by myself, this seems a bit overkill.
What other suggestions would you recommend? I was looking at sending an API key/signature along with the POST request.
It should be done the same way you make javascript calls secure. You use sessions. You should be able to send and receive headers, why not accept cookie-like data? At least session_id. Securing with SSL for open wifi hotspots would also be very beneficial if you use symmetric authentication.
OAuth has a different purpose - its when your website starts to host third party applications that users want to use without giving this app own password.