I need games under $10 on Steam. How should an inquiry be made for this?
api link here
In the link here, I can only fetch games under $10 as json, but there is no information such as game id prices.
I need these. Thank you
$steamUnder20 = Http::get("https://store.steampowered.com/search/results?maxprice=20&cc=tr&l=turkish&json=1");
$resultUnder = $steamUnder20->json();
Result :
"desc": "",
"items": [
{
"name": "Black Desert",
"logo": "https://cdn.akamai.steamstatic.com/steam/apps/582660/capsule_sm_120.jpg?t=1658233501"
},
{
"name": "Slime Rancher",
"logo": "https://cdn.akamai.steamstatic.com/steam/apps/433340/capsule_sm_120.jpg?t=1651003375"
},
Steam offers an endpoint called appdetails that allows you to fetch a whole lot information about one or multiple comma-separated game IDs specified in the appids parameter:
http://store.steampowered.com/api/appdetails?appids=1,2,3
According to the inofficial documentation by RJackson in the Team Fortess wiki you can specify the values you need in the filter parameter, otherwise the response will include all basic details: https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
In your case I suggest iterating through your response and parsing the gameID from the logo URL and using them collectively for the appdetails endpoint to fetch all the information.
Additionally, you can also use the cc parameter to specify a currency and the l parameter to localise the response. These parameters are not documented in the documentation by RJackson.
Related
I want to send different JSONs to this endpoint:
{{URL_API}}/products/
I need to update several information related to different products so i need to specify the product within the endpoint, i mean, i.e:
If you access this particular endpoint: {{URL_API}}/products/ you will get all the products but i need to specify the product that i want to update:
{{URL_API}}/products/99RE345GT
So, i decided to create a CSV file, i will update all the different product passing that file in the COLLECTION RUNNER screen, do you get me?.
For that, i created a new collection, i put this request_url:
{{URL_API}}/ns/products/{{sku}}
I edited the request body:
{
"sku": "{{sku}}",
"price": "{{price}}",
"tax_percentage": "{{tax_percentage}}",
"store_code": "{{store_code}}",
"markup_top": "{{markup_top}}",
"status": "{{status}}",
"group_prices": [
{
"group": "{{class_a}}",
"price": "{{price_a}}",
"website": "{{website_a}}"
}
]
}
all those fields between the {{}} will be completed by the CSV but it shows an error message over the url_request, {{sku}} seems to be wrong... it throws this message error:
unresolved variable, this variable is not defined in the active
collection, environment or globals.
How can i solve this? I do not know what to do now.
What am i missing?
After creating a Group using POST /v1.0/groups with the body:
{
"description": "hello",
"displayName": "group_for_restore",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "group_for_restore",
"securityEnabled": false,
"visibility": "Public"
}
A request to GET /v1.0/groups/{group-id}/planner/plans does not retrieve any plans.
As far as I know, after creating a Group, a Plan will be created too. On the web interface you can see that this plan is correctly created and shown, but it does not appear in JSON response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerPlan)",
"#odata.count": 0,
"value": []
}
After clicking on it in the web interface you can easily get the plan using the request above.
Is it ok to do such magic steps to fetch plan id?
The Web App is provisioning the Group's Plan the first time you attempt to access it. When creating a Group through the API however, you'll need to create a new Plan yourself:
POST https://graph.microsoft.com/v1.0/planner/plans
Content-type: application/json
{
"owner": "group-id",
"title": "title-value"
}
Keep in mind this important note from the documentation:
When creating a new plan, make a group its owner by simply setting the owner property on a plan object.
I'm having a hard time finding for the API in getting the contacts of the people who open the newsletter after sending it to a list of email. In the official API documentation of GetResponse, I didn't find a solution. Any idea or suggestion can help. thanks.
Though it's rather old now, I'll try to answer, maybe it helps someone.
Just as inside GetResponse web interface, you'll need to search contacts according to some criteria. These pages of the API docs describe how this is done:
http://apidocs.getresponse.com/v3/resources/search-contacts
Search contacts is the most complex part of the API. To save a search of contacts who opened a particular message you'll need to POST something like below to https://api.getresponse.com/v3/search-contacts/:
{
"name": "test_conditions", //can be any you like
"subscribersType": [
"subscribed" //can also be "undelivered", "removed" and "unconfirmed"
],
"sectionLogicOperator": "or", //or "and"
"section": [ //section can have up to 8 conditions; one saved search can have up to 4 sections
{
"campaignIdsList": [
"V" //you'll need to get campaigns' IDs with http://apidocs.getresponse.com/v3/resources/campaigns#campaigns.get.all
],
"logicOperator": "or",
"subscriberCycle": [
"receiving_autoresponder",
"not_receiving_autoresponder"
],
"subscriptionDate": "all_time", //"today", "yesterday", "this_month", "last_month", "this_week", "last_week" are also possible
"conditions": [
{
"conditionType": "opened",
"operatorType": "message_operator",
"operator": "autoresponder", //or "newsletter", or "split"
"value": "WTjXF" //message id, should be firstly got with a separate API call
}
]
}
]
}
More info on how the payload for such requests should be formed is here: http://apidocs.getresponse.com/v3/resources/search-contacts-reference
And the last point: if you don't need to save a search but only get the emails who've opened a message, in the object above you should remove the "name" property and post this to http://apidocs.getresponse.com/v3/search-contacts/contacts
More: http://apidocs.getresponse.com/v3/resources/search-contacts#search-contacts.contacts.form
I'm new to API's but made a bit of headway today in integrating a call to the Duedil (UK Company information directory).
I'm doing this in Salesforce using Buttons
My first call is an easy search on Account Name in Salesforce
CALL 1:
http://api.duedil.com/open/search?q={!Account.Name}&api_key=MY_API_KEY
"Arjo Fine Paper" is the Account.
The response returned is:
{
"response":
{"pagination":"http:\/\/api.duedil.com\/open\/search?query=Arjo+Fine+Paper&total_results=3&limit=5&last_result=1",
"data":[
{
"company_number":"**00961440**",
"locale":"United Kingdom",
"name":"Arjo Wiggins Fine Papers Limited",
"uri":"http:\/\/api.duedil.com\/open\/uk\/company\/00961440.json"
},
{
"company_number":"01870033",
"locale":"United Kingdom",
"name":"Arjo Wiggins Fine Papers Export Limited",
"uri":"http:\/\/api.duedil.com\/open\/uk\/company\/01870033.json"
},
{
"company_number":"00683415",
"locale":"United Kingdom",
"name":"Arjo Wiggins Fine Papers Holdings Limited",
"uri":"http:\/\/api.duedil.com\/open\/uk\/company\/00683415.json"
}
]
}
}
What I want to do is parse the first Company number and then display the results
e.g. "https://www.duedil.com/company/00961440"
Do I embed Call 1 in some JS that can parse out the answer from Call 1?
Thanks for any help/steers.
Try to have a look at the Salesforce doc ( here ) for parsing the JSon Strings or Serializing the information back to some Collection of Objects (or Wrapper classes).
You may also have a look at serializing your information (in form of Collection, Object or a String) using JSON.serialize() method while to get the information back (Collection, Object or String) you need to use JSON.desrialize() by typecasting it.
I'm relatively new to REST but I've been doing my homework on how RESTful should be. Now I'm trying to create a RESTful api implementing a JSON+HAL serializer for my models which have relationships with other models.
Example models in python:
class Category(Model):
name = CharField()
parent = ManyToOneField(Category)
categories = OneToManyField(Category)
products = ManyToManyField(Product)
class Product(Model):
name = CharField()
price = DecimalField()
related = ManyToManyField(Product)
categories = ManyToManyField(Category)
lets suppose we have a category "catalog" with a sub-category "food" with products "burger" and "hot-dog" which are both related.
First question. Categories and products should be resources so they need an URI, should I implement an uri field in my model and store it in the DB or somehow calculate it at runtime, what about multiple identifiers(URIs)?
Second question. Discoverability, In Hal format what should "GET /" and diferent nodes return to make the api easily self discoverable.
{
"_links":{
"self":{
"href":"/"
},
"categories":[
{
"href":"/catalog"
}
]
}
}
Third question. Add as properties, embed or link. Example "GET /catalog/food":
{
"_links":{
"self":{
"href":"/catalog/food"
}
},
"name":"food",
"parent":"/catalog",
"categories":[],
"products":[
"/products/burger",
"/products/hot-dog"
]
}
{
"_links":{
"self":{
"href":"/catalog/food"
},
"parent":{
"href":"/catalog"
},
"categories":[
],
"products":[
{
"href":"/products/burger"
},
{
"href":"/products/hot-dog"
}
]
},
"name":"food"
}
{
"_links":{
"self":{
"href":"/catalog/food"
}
},
"name":"food",
"_embedded":{
"parent":{
"_links":{
"self":{
"href":"/catalog"
}
},
"name":"catalog",
...
},
"categories":[
],
"products":[
{
"_links":{
"self":{
"href":"/products/burger"
}
},
"name":"burger",
...
},
{
"_links":{
"self":{
"href":"/products/hot-dog"
}
},
"name":"hot-dog",
...
}
]
}
}
Fourth question. How deep should I go when returning structures. Example "GET /catalog
{
"_links":{
"self":{
"href":"/catalog"
}
},
"name":"catalog",
"parent":null,
"categories":[
{
"name":"food",
"parent":{...},
"categories":[],
"products":[
{
"name":"burger",
"price":"",
"categories":[...],
"related":[...]
},
{
"name":"hot-dog",
"price":"",
"categories":[...],
"related":[...]
}
]
}
],
"products": []
}
About 1st question: I wouldn't store the URIs in the DB. You can easily calculate them inside your controller in runtime, and it's of controller's responsibility to care about URIs. This way you keep your model and your API decoupled, and should you decide to change the API structure in the future, you won't need to update your whole database with the new URIs.
About multiple identifiers, I'm not sure what the question is, but again, in my opinion, it has nothing to do with the DB, it's the routing and the controllers who should care about how to deal with any URIs.
About 2nd question: First of all, as a side note: I would keep the word categories as part of the URI. For example, I 'd have http://domain.com/api/categories/catalog/food. This way, you make your API more descriptive and more "hackable", meaning that user should be able to remove the /catalog/food part and expect to receive a collection with all the available categories.
Now, about what GET should return to allow discoverability: I think it's already being made clear from your URI structure. When user hits GET /categories he expects to get a list with the categories (the name and URI for each, to keep it lightweight), and when he follows one of the URIs like GET /categories/catalog he should receive the resource catalog which is a category. Likewise, when he wants to GET /products/burger, he should receive a product resource with all the attributes you have in your model. You may want to check this example about the structure of your responses.
About 3rd question: Again, the same example can help you form the structure. I think your 2nd way of response is closer to that, but I would also add a name field, not only the href.
About 4th question: When the GET request expects a collection of resources (like GET /categories) I would suggest providing only the necessary for each resource, that is, the name and the URI for each and only when user follows the desired URI, he can receive the rest information.
In your example, catalog is a resource, so on GET /categories/catalog I would include of course the name of the resource (catalog) and its self link, and for parent, sub-categories and products that are related to it, I would just provide the name and the URI for each, to keep it light. But: This was a general thought about designing APIs. In your actual problem, you should decide depending on your specific business problem. I mean, if your API is about a restaurant menu with categories and dishes, you may want to include the price, or a small description even when responding not for the actual product but for a collection of products, because probably for your users, that's an important information. So generally, provide all the necessary info (you only know what are these for your problem) when responding about a list of resources, and provide all the details of the resource when responding about a specific resource.
I would store something in the DB and calculate the URI at Runtime. That way if you move boxes it's not static.
Create a 'bookmark' page. The page we created was just a list of links with their rels. I believe HAL defines that specifically. The bookmark page was the only page other pages needed to know about
Not sure about this
How deep you go is up to you. There is a big debate now at my place of work for fine grain vs course grain. I'm going to do fine grain with small resource to keep the api simple, but then use the Expand-ability concept. It's a combination ofthe idea of composite resources defined on pg 35 of Subbu’s REST book and the expand concept used by Netflix. http://developer.netflix.com/docs/REST_API_Conventions