Hi (Sorry for my english),
I would be use the new tools windows : REST Client in PHPStorm 6, but i have a little problem.
I write my soap url and it's ok, i retrieve the xml response (look at Heberger image http://img15.hostingpics.net/thumbs/mini_529269screen1.png).
After that i want call the method : login but i don't see how that work, how pass this method to the rest api. (look at Heberger image http://img15.hostingpics.net/thumbs/mini_696499screen2.png)
And the xml response was :
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>Sender</faultcode><faultstring>Invalid XML</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Thank you for your response (and correction on my bad english :( )
Judging the response your service uses SOAP, why this client is tailored for REST. Take a look at Representational state transfer (REST) and Simple Object Access Protocol (SOAP) to get the difference.
Basically to perform the request you need to provide a properly formatted request body (which may be quite elaborate).
Related
Just started working on an existing project making use of the Exact Online API.
While I was debugging the project I suddenly only started receiving XML results instead of JSON results from the API. I did not change anything about the endpoints being queried I was just running the existing queries trying to figure some things out.
These are the REST API docs: https://start.exactonline.nl/docs/HlpRestAPIResources.aspx
These are the XML docs: https://support.exactonline.com/community/s/knowledge-base#All-All-DNO-Content-xmlsamplecode
Typical REST API endpoints look like this:
https://start.exactonline.be/api/v1/xxxxxx/salesinvoice/SalesInvoices
Typical XML endpoints look like this:
https://start.exactonline.be/docs/XMLDownload.aspx
I also did not change any settings. I only have access to the tokens and api. I don't have access to the account.
This is an example of an endpoint and query where I previously received JSON but am now receiving XML:
https://start.exactonline.be/api/v1/xxxxxx/salesinvoice/SalesInvoices?$filter=InvoiceID eq guid'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'&$select=InvoiceID
I tried this manually with Postman and also using the existing code from the project.
Is there some setting I am unaware of? Am i querying the wrong way? Maybe there have been some changes to the API I am unaware of that aren't listed in the release notes?
Please provide the request header Accept in your HTTP request that specifies what content format you prefer to receive: application/json. The default of Exact Online APIs is XML (but seldom to never used).
I want to generate a rest api in odoo so that it can be used in other languages. I have used below api's
http://URL_with_PORT/{}/xmlrpc/2/common
http://URL_with_PORT/{}/xmlrpc/2/object
but when I validated it using postman it is giving me error.
You don't need the curly braces in the URL. Just send it to the xmlrpc/2/common endpoint, as per...
http://<server:?port>/xmlrpc/2/common
You need to set the verb to POST, and the body to raw with XML.
Then send in the following XML in the form as per the documentation.
<?xml version='1.0'?>
<methodCall>
<methodName>version</methodName>
</methodCall>
This will return the server version info as per the examples used in the External API documentation in an XML response.
Postman isn't the best client to use XML-RPC calls, take a look at XML RPC GUI for developers in Windows?. You have to create a raw request and then send it. Using SoapUI would be much easier.
I'm using Twilio with my app and I have sms webhooks with my SMS numbers configured with URL.
Everything is working except that Twilio send me an error in logs for each requests.
I suppose that the response from my app is not well formated but I can't find on documentation how to format using JSON.
Can someone help me ? :)
Thanks,
Gabriel
Twilio developer evangelist here.
When you return a webhook message to Twilio, you need to make sure it's valid TwiML, which in essence is just a set of XML verbs Twilio uses.
If you're responding to an SMS message for example, you would return TwiML as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message>Thanks for getting in touch, I'll call you later</Message>
</Response>
You can test the code above by changing the configuration of your number to point to this url and you should stop seeing the errors.
If you generating the TwiML yourself, you need to make sure that the page's MIME type is text/xml.
Hope this helps you out.
I am working on a JSON project and I basically want to hit on some specified URL with some request and get the response back. I want to know if there are some sites available that can provide me help for request, response on JSON?
Any sort of help is welcome!
Back when "Ajax" was being coined (and well before), we often used the XML HTTP Request object (W3 Schools) but web development is more mature now. Libraries such as jQuery wrap this functionality for easy use (jQuery Ajax)
I'm writing a RESTful web application where I need to provide the service of uploading images for a user. Currently, I have been able to upload an image from my current machine but I need to send it as JSON data over the web through the REST protocol.
In the server, there is a Java application running Jax-RS to manage the RESTful service. I was planning to save the JSON data that contains the image in the server and then provide a URL to the user for him to be able to locate it's image on the server.
Can someone provide some ideas on how can I do this?
If you want to send the image in a JSON object, then the image should be Base64 encoded it, or some other form of encoding. Then on the server side you will need to unmarshal the JSON and then decode back the image. You can get some ideas here on how that can be done.
Optionally, instead of doing all the converting inside the resource method (as in the example linked above), you could write a custom MessageBodyReader, where you can do the unmarshalling and decoding there.
If you decide you don't want to work with JSON, you can go the normal route and use Multipart. Depending on the implementation of JAX-RS you are using, multipart support will be different. You can see some examples (all examples have links to the official documentation)
Jersey example
Resteasy example
CXF example
There are other implementations, but I don't have examples for those. You will need to search for the documentation if you're using an implementation other than listed above.