Get Method is not working inside App if URL contains .info? - objective-c

I am making a simple GET Method inside the APP , But its Not Working on some URL..
For Eg :
https://lievensberg.webcamconsult.com/wachtkamer/ZwXIk9KcYvMBFeJWiSeUQQ.json . - this is working (contains .com)
https://soa-webcamconsult.sense.info/wachtkamer/pk3rs51FpFUQkrHOJ0uBHg.json - this is not working (contains .info)
Both URL is Working Perfect in Browser...!
I am using AFNetworking, Any one can Help Me Please ?
This is the Call Method , Url given below
//https://soa-webcamconsult.sense.info/wachtkamer/pk3rs51FpFUQkrHOJ0uBHg.json
NSDictionary *header = [NSDictionary dictionaryWithObjectsAndKeys:#"application/json",#"Content-Type", #"application/json", #"Accept", #"iPhone",#"User-Agent",nil];
NSLog(#"url---%#",url);
NSLog(#"header---%#",[Utilities printJson:header]);
[SSNetworkClient initServerCallWithURL:url requestMethod:SSRequestMethodGET requestSerialize:YES headers:header imageData:nil imageDataName:nil parameters:nil success:^(id object) {
completionBlock(YES,object);
} failure:^(id object) {
failureCompletion(NO,object);
}];

In you response of second url you are getting invalid json and which should be like this,
{
"status": {
"code": "on_time",
"message": "U bent op tijd",
"content": "Uw afspraak begint om *|afspraak_tijd|* ."
},
"slave": {
"name1": "Dhr. sunny",
"name2": "Meneer sunny"
},
"master": {
"name1": "Mr beheerder"
},
"push": {
"origin": "pubsub.pubnub.com",
"pub_key": "pub-c-a6ca4c51-0a6f-475d-8f93-f53f48ba117b",
"sub_key": "sub-c-97578f62-3587-11e3-be49-02ee2ddab7fe",
"uuid": "sunny-5a323ac22cacff0004c2a717",
"channels": ["5a29524f2b4faa000470384a", "5a323ac22cacff0004c2a717"]
},
"lobby_message": "",
"contact_info": "/dyncontent/pk3rs51FpFUQkrHOJ0uBHg"
}
Above is the correct json which you will need to improve in your api response
And if you wont verify just create the json file with above json it will work perfectly with browser and with your .info api response json it won't work so you need to improvise your .info json file response
My Mozilla browser Quantum version response,

Related

Shopware 6 Admin Api - Updating existing record through patch method. Not working

shopware 6 admin api patch - why it's failing? I get error "Only single write operations are supported"
Following is api for rule-condition entity in the database, I update it with Id.
For same api get method is working!
url: api/rule-condition/dbb0d904c7c14860a9a94cf26b94eca6
method: patch
json body
[
{
"op": "replace",
"path": "/data/attributes/value/email",
"value": "test#gmail.com"
}
]
response:
{
"errors": [
{
"code": "0",
"status": "400",
"title": "Bad Request",
"detail": "Only single write operations are supported. Please send the entities one by one or use the /sync api endpoint.",
.......
I also tried changing json body to following
{
"data": {
"attributes": {
"value": {
"email": "test#gmail.com"
}
}
} }
Still it's not updating. Can somebody check and let me know what am i missing?
Documentation I followed:
https://shopware.stoplight.io/docs/admin-api/ZG9jOjEyMzA4NTQ5-writing-entities
This website has all apis and example methods. https://swagger.docs.fos.gg/,
rule-condition entity can also be found there.
Btw : I used postman for testing api
You're passing an array of objects in the request body, suggesting you want to update multiple records, but the endpoint only supports updating a single record. The correct payload in your case should look like this:
{
"value": {
"operator": "=",
"email": "test#gmail.com"
}
}
Notice that value is a json field and not only includes a single value. The exact content and the names of the properties of value depend on the type of condition used and usually it also includes the operator used in the condition.

POSTMAN COLLECTION RUNNER: passing the all body post request as a variable?

I have a POST request template - instead putting all the JSON body i put a variable: {{bodyRequest}}
now i have a json file that looks like this(Below code bloc) that i upload in my collection runner as data json: my intention is to fetch {{bodyResponse}} from the iteration and make the post call in the api.
[
{ "{{bodyRequest}}":
{
"order": {
"order_date":"{{$timestamp}}",
"order_number":"{{$guid}}",
"reference":"Scenario1",
"destination":
{
"name":"test",
"phone":"00000",
"email":"test#test.com",
"company":"My Company",
"building":"My Building",
"street":"my street",
"suburb":"my sububr",
"post_code":"my postcode",
},
}
}
}
]
Then i click run
Open Collection Runner
Add Data file in Format JSON (above in code)
declare it as Json
run collection
Error Log
Request Body:"{{bodyRequest}} "
instead the all payload
thank you so much
Franco

How to get track ID from URL using the SoundCloud API

How can I get a track ID from a track URL using the SoundCloud API?
You didn't specify a language in your question, so I'm just going to provide a high-level answer.
Use the resolve endpoint. I'm using this URL as an example:
https://soundcloud.com/msmrsounds/ms-mr-hurricane-chvrches-remix
HTTP GET: https://api.soundcloud.com/resolve.json?url=https%3A%2F%2Fsoundcloud.com%2Fmsmrsounds%2Fms-mr-hurricane-chvrches-remix&client_id=[your_client_id]
The resulting JSON:
{
"status": "302 - Found",
"location": "https://api.soundcloud.com/tracks/147986343.json?client_id=[YOUR client_id]"
}
That numerical value is the track_id. You can just stop here or hit that endpoint you just got back for more information:
{
"kind": "track",
"id": 90787841,
"created_at": "2013/05/05 00:15:40 +0000",
"user_id": 7853935,
"duration": 188333,
"commentable": true,
"state": "finished",
"original_content_size": 35031144,
"last_modified": "2014/09/30 05:53:10 +0000",
"sharing": "public",
"tag_list": "MSMR CHVRCHES \"Secondhand Rapture\" Remix Hurricane",
"permalink": "ms-mr-hurricane-chvrches-remix",
"streamable": true,
"embeddable_by": "all",
"downloadable": true,
"purchase_url": null,
"label_id": null,
"purchase_title": null,
"genre": "",
"title": "MS MR - Hurricane (CHVRCHES remix)",
"description": "MS MR - Hurricane (CHVRCHES remix)\r\n\r\n\r\n",
"label_name": "",
"release": "",
"track_type": "",
"key_signature": "",
"isrc": "",
"video_url": null,
"bpm": null,
"release_year": null,
"release_month": null,
"release_day": null,
"original_format": "wav",
"license": "all-rights-reserved",
"uri": "https://api.soundcloud.com/tracks/90787841",
"user": {
"id": 7853935,
"kind": "user",
"permalink": "msmrsounds",
"username": "MSMR",
"last_modified": "2014/08/04 09:03:56 +0000",
"uri": "https://api.soundcloud.com/users/7853935",
"permalink_url": "http://soundcloud.com/msmrsounds",
"avatar_url": "https://i1.sndcdn.com/avatars-000037198343-2lptmy-large.jpg?86347b7"
},
"permalink_url": "http://soundcloud.com/msmrsounds/ms-mr-hurricane-chvrches-remix",
"artwork_url": null,
"waveform_url": "https://w1.sndcdn.com/56LCadzDEBZn_m.png",
"stream_url": "https://api.soundcloud.com/tracks/90787841/stream",
"download_url": "https://api.soundcloud.com/tracks/90787841/download",
"playback_count": 1672227,
"download_count": 18494,
"favoritings_count": 20426,
"comment_count": 464,
"attachments_uri": "https://api.soundcloud.com/tracks/90787841/attachments",
"policy": "ALLOW"
}
Since the SoundCloud API is indefinitely not accepting new registrations, here's one alternative solution. This URL will provide you with a wide/short embedded player:
https://w.soundcloud.com/player/?url= + URL of track
Example: https://w.soundcloud.com/player/?url=https://soundcloud.com/chrisbjerken/picking-up-the-pieces
This works for both a single track or a playlist.
So my final code looks like this. Thank you guys for the help to get this working.
include_once('../Services/Soundcloud.php');
$client = new Services_Soundcloud('CLIENT_ID', 'CLIENT_SECRET');
$track_url=$_POST['trackurl'];
$track_url=str_replace("https://soundcloud.com/USERNAME/","",$track_url);
$track = json_decode($client->get("tracks/".$track_url));
$track_id=$track->id;
echo $track_id;
In The Meantime Writing This Answer The CLIENT_ID Is Close
Due to the high amount of requests recently received, we will no longer be processing API application requests at this time. We are working to re-evaluate our process to make it more efficient.
See Here
I Solved This Issue With My Laravel Project Like This
first I Made This Function To Get The Real Content
public function getLessonUrl($lessonId = null)
{
//Get the SoundCloud URL
$validUrl = 'https://soundcloud.com/al-hazme';
$result = stripos($lessonId, $validUrl);
if (strpos($lessonId, $validUrl) !== false) {
//Get the JSON data details with embed code from SoundCloud oEmbed
$getValues = #file_get_contents('http://soundcloud.com/oembed?format=js&url=' . $lessonId . '&color=%234274e3&auto_play=false&hide_related=true&show_comments=false&show_user=false&show_reposts=false&show_teaser=true&show_artwork');
if ($getValues === false) {
return 'حدث خطأ اثناء تحميل الدرس نرجو منك التأكد من اتصال الانترنيت لديك او حدث الصفحة';
}
//Clean the Json to decode
$decodeiFrame = substr($getValues, 1, -2);
//json decode to convert it as an array
$jsonObj = json_decode($decodeiFrame);
//echo $jsonObj->html;
$lessons = str_replace('height="400"', 'height="90"', $jsonObj->html);
return $lessons;
} else {
return 'لايوجد استماع لهذا الدرس';
}
}
Then I Made Another Function To Crap The Id Using Str Facade Methods
use Illuminate\Support\Str;
public function soundCloudId($url) {
$do = $lesson->getLessonUrl($lesson->url_link);
$getTrickId = Str::after($do,'tracks%2F');
$substr = Str::substr($getTrickId,0,9);
echo $substr = // 367893857
}
It May Help Or Give You Clue
I know this is kinda late but i faced the same issue yesterday and found a new (undocumented) endpoint that you can use.
https://api-widget.soundcloud.com/resolve?url=SOUNDLCOUD_URL&format=json&client_id=CLIENT_ID
You can find your CLIENT_ID by looking at the Network Inspector in the DevTools and select the XHR filter while browsing the SoundCloud website.
I think this is sufficient until the official APIs are usable again.

Shopify API, unable to create order

I created private application on my test shop and I am trying to create simple order via the Shopify API following the instructions found here:
http://docs.shopify.com/api/order#create
I am using the last example, and sending POST request to admin/orders.json with this in the body of the request:
{
"order": {
"line_items": [
{
"quantity": 1,
"variant_id": 500775053
}
]
}
}
500775053 is a valid variant id.
The response I'm getting is:
{
"errors": {
"line_items": [
"must have at least one line item"
]
}
}
I don't understand what am I doing wrong? Is there some special parameter that I should pass along the request? Some special header?
Thank you for your help!
Try adding these custom headers:
Content-Type: application/json
Accept: application/json

Instagram API getting error on UTF-8 characters (tested on /tags/{TAGNAME}/media/recent)

Shamelessly stolen from this ( https://groups.google.com/forum/#!topic/instagram-api-developers/tRfU444ZyhU ) thread as I have the exact same issue and hoping for better responses here.
Long story short, a few hours ago this was working, now it isn't.
The test platform can be found at both from my website and https://apigee.com/console/instagram
Sending https://api.instagram.com/v1/tags/türkiye/media/recent (careful with the "ü")
result: {
"meta": {
"error_type": "OAuthParameterException",
"code": 400,
"error_message": ""client_id" or "access_token" URL parameter missing. This OAuth request requires either a "client_id" or "access_token" URL parameter."
}
}
Sending https://api.instagram.com/v1/tags/turkiye/media/recent (now with "u")
result: {
"pagination": {},
"meta": {},
"data": [
{},
{},
{},
{},.. .. .. ... and so on
Sending https://api.instagram.com/v1/tags/türkiye/media/recent?client_id=7176aa6ef2fd47fd9cb373a5354bd30f ("ü" again and this time manually attached client_id)
result: {
"meta": {
"code": 200
},
"data": {
"media_count": 1471127,
"name": "t"
}
}
This time I'm getting the name as "t". It seems the query is broken just before the "ü" letter which is UTF-8 (Turkish if needed).
This is a bug on Instagram-side. There's an open discussion on Instagram Developers Google group. Although, from what I've seen in my application, the bug now resolve.