CURL request in iOS - ios

I'm trying to make use of the CO-OP API for some purposes in my app (http://coopapp.com/api)
I know how to preform the request using curl:
curl http://coopapp.com/groups/20/statuses -H 'Accept: application/xml' \ -H 'Content-Type: application/xml' -u email:password
But I can't figure out how to do this in iOS, hopefully somebody can give me a push in the right direction.

You do that with the NSURLConnection class. But I recommend using MKNetworkKit which is a handy wrapper around it. It actually even shows the equivalent curl command in the description of its operations.

If you want to load the same web page use UIWebView,Same HTML page will be loaded

Related

msgraph teams api, filter for groups only with teams

I have a requirement to filter for teams which have a given string. To achieve that I found the following documentation https://learn.microsoft.com/en-us/graph/teams-list-all-teams. I cannot use the beta APIs, so the only option left for me as per this is to
Get all the teams using /groups?$select=id,resourceProvisioningOptions
Manually do the filtering
I am a bit worried that this could overload the server since I am loading a lot of data and then filtering, is there a better way to do this?
Also I tried the following curl command curl -H "Accept: application/json" -H "Authorization: Bearer token" -X GET "https://graph.microsoft.com/v1.0/groups?$select=id,resourceProvisioningOptions" -k but this returns all the fields like expirationDateTime, displayName and so on. Am I doing something wrong in this curl command
Please check below curl command
curl --location --request GET 'https://graph.microsoft.com/v1.0/groups?$select=id,resourceProvisioningOptions,displayName&$filter=startswith(displayName,%27abc%27)' \
--header 'Authorization: Bearer token'

trying to send https string to website in lua

I am sort of new to lua and I have API that I need to call.
"https://status.abc.com/integrations/plus/?endpoint="..number.."&server="..server
This is not in a json format. It is just sending this http string to a web server. What is the simplest way to acomplish this?
local ok =os.execute([[curl --cert /etc/openvpn/cert.crt --key /etc/openvpn/key.key -X POST -H 'Content-Type: application/x-www-form-urlencoded' 'url here' --data 'data here']])
Try looking into the LuaSec library.
There is no https support native to lua so your (as far as i know) only option is to build LuaSec or try to find a build on the internet

Using REST API to deploy Liberty Docker containers

Has anyone been able to use the WebSphere Liberty REST API to deploy remote Docker containers? The docs describe all the steps, but I am not able to repeat the results. I get an error when calling REST deploy function (details are posted on the other forum).
If anyone was able to do it - please let me know and would be great if you share how you were able to do it.
Not long after posting this question I tried using the curl command with the JSON header spec and now it works. Here is the curl command I am using that works:
curl --verbose --insecure -X POST --data #docker_deploy.json --header "Content-Type: application/json" -u ${ADMIN_USER}:${ADMIN_PASSWORD} https://${CONTROLLER_HOST_NAME}:${CONTROLLER_PORT}/ibm/api/collective/v1/deployment/deploy

How can I test a Rails app using WGET

I want to test my rails app using "wget", specifically the part that returns JSON-data. I don't really understand the syntax I should use. I have tried this:
wget --user=username#example.com --password=somepass localhost:3000/folders/1.json
and variations of it, without any success. Which is the exact syntax? Would it be better to use CURL instead?
-- edit --
I found at this blog:
http://blogs.operationaldynamics.com/andrew/software/research/testing-rest-the-hard-way
this suggestion:
$ wget -S -q --header "Accept: application/json" -O - http://localhost:3000/folders/1
but even when I add
--user=username#example.com --password=somepass
...I get 401 Unauthorised. The username is correct, I can login via the browser.
curl -u username:password http://localhost:3000/folders/1.json
Read more here http://curl.haxx.se/docs/manpage.html#-u
An alternative to curl is the less well known but equally capable httpie - https://github.com/jkbrzt/httpie - I find it to be a bit more straightforward and friendly to use, and includes syntax colouring for output.
http -a user:pass :3030/folders/1.json would do the trick here, I think.

Single quote formatting issue in curl syntax

I integrated linkedin with Rails 4 and trying to share post on linkedin.
I used curl in rails and post on linked-in wall using below curl post. I used below code in rails console and its work fine but when i used it in rails code with system and single quote then issue create because already single quote use in inside.
system 'curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"comment":"hello from system www.google.com! http://google.com","visibility":{"code":"anyone"}}' https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=xxxxxXygzp_8E3xxvg7_7FaxxxxxxnxtWzBXAxxxxa0wta5z1MVK6-kubHJ5JxxxndpAMc_CxmCsIHxFlxxx0t_WNEhxxxMz8_cKpeOidAxxx5-X-MdvzYVxxQ&format=json&title=linkedin HTTP/1.1'
What do I have to add to resolve this issue? I tried a lot then I posted here.
Thanks in advance.
In your application (as opposed to in the terminal), I suggest you use an HTTP library (I use HTTParty, but there are many options).

Resources