Location based pricing in Softlayer via API - api

The script in the following link provides location based pricing for each item:
http://sldn.softlayer.com/blog/cmporter/location-based-pricing-and-you
When I run above script for example for Toronto location, the returned value does not match the pricing in the SL portal for Toronto. For example, the script returns 8GB # 0.085/hr vs pricing from portal which is 0.090 for 8GB in Tor:
"864": {
"capacity": "8",
"description": "8 GB",
"id": 864,
"itemCategory": {
"categoryCode": "ram",
"id": 3,
"name": "RAM",
"quantityLimit": 0
},
"itemTaxCategoryId": 166,
"keyName": "RAM_8_GB",
"prices": [
{
"currentPriceFlag": "",
"hourlyRecurringFee": ".085",
"id": 112677,
"itemId": 864,
"laborFee": "0",
"locationGroupId": 503,
"onSaleFlag": "",
"oneTimeFee": "0",
"packageReferences": [
{
"id": 891477,
"itemPriceId": 112677,
"packageId": 46
}
],
"quantity": "",
"recurringFee": "56.75",
"setupFee": "0",
"sort": 0
}
],
"softwareDescriptionId": "",
"units": "GB",
"upgradeItemId": ""
},
What's wrong with this APIs?

Can you make double check please? because I verified that Portal is displaying the same price than API. I believe the price that you saw was for other datacenter.
Select first the datacenter: TOR01 - Toronto
Check the price for RAM 8 GB

Related

Strapi filtering localization with images

I think problem may be in how I compose the request for API?
According to strapi documentation strapi docs there is possible to filter data by using following syntax. GET /api/:pluralApiId?filters[field][operator]=value
example:
Example request: Find users having 'John' as first name
So my goal is get images and text for specific localization for my collection AboutBox which contains 3 text fields and 1 media type. My request look like this: api/about-boxes?populate=*&?filters[locale][$eq]=en
What return request look like:
{
"data": [
{
"id": 1,
"attributes": {
"title": "About us",
"createdAt": "2023-02-08T07:47:38.543Z",
"updatedAt": "2023-02-09T08:49:40.543Z",
"publishedAt": "2023-02-08T07:48:48.681Z",
"locale": "en",
"text": "At CGI we provide a wide range of services and solutions that significantly help our clients grow financially and technologically. Our CGI CZ Space team focuses on the use of satellite data for remote scanning of the Earth tailored to all our customers across sectors. We deliver projects to the European Space Agency (ESA), participate in the development and support of the Galileo navigation system and more.",
"buttonText": "Check it out",
"logo": {
"data": {
"id": 3,
"attributes": {
"name": "cgi_logo.svg",
"alternativeText": "cgi_logo",
"caption": null,
"width": 59,
"height": 27,
"formats": null,
"hash": "cgi_logo_934146d58f",
"ext": ".svg",
"mime": "image/svg+xml",
"size": 0.98,
"url": "/uploads/cgi_logo_934146d58f.svg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-08T07:46:17.180Z",
"updatedAt": "2023-02-08T07:48:31.102Z"
}
}
},
"localizations": {
"data": [
{
"id": 2,
"attributes": {
"title": "O nás",
"createdAt": "2023-02-08T07:47:50.849Z",
"updatedAt": "2023-02-10T14:04:21.010Z",
"publishedAt": "2023-02-10T14:04:20.963Z",
"locale": "cs",
"text": "Ve společnosti CGI poskytujeme širokou škálu služeb a řešení, která našim klientům významně pomáhají finančně a technologicky růst. Náš tým CGI CZ Space se zaměřuje na využití družicových dat pro dálkové snímkování Země na míru všem našim zákazníkům napříč odvětvími. Dodáváme projekty pro Evropskou kosmickou agenturu (ESA), podílíme se na vývoji a podpoře navigačního systému Galileo a dalších.",
"buttonText": "Podívejte se na to"
}
}
]
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 1
}
}
}
What I am expecting is get only data where is: "locale": "en",
not the one where is "locale": "cs",
basically without this block
"localizations": {
"data": [
{
"id": 2,
"attributes": {
"title": "O nás",
"createdAt": "2023-02-08T07:47:50.849Z",
"updatedAt": "2023-02-10T14:04:21.010Z",
"publishedAt": "2023-02-10T14:04:20.963Z",
"locale": "cs",
"text": "Ve společnosti CGI poskytujeme širokou škálu služeb a řešení, která našim klientům významně pomáhají finančně a technologicky růst. Náš tým CGI CZ Space se zaměřuje na využití družicových dat pro dálkové snímkování Země na míru všem našim zákazníkům napříč odvětvími. Dodáváme projekty pro Evropskou kosmickou agenturu (ESA), podílíme se na vývoji a podpoře navigačního systému Galileo a dalších.",
"buttonText": "Podívejte se na to"
}
}
]
}
Also for unknow reason when I get request for czech localization I did not get data in return:
czech request return
Any help would be appreciated
According to Strapi docs you can receive localized entries via GET /api/{content-type}?locale={locale-code}

Setting up Continuous export of API data to csv for Racing lap times

Have access to an API that provides data for racing, including driver names, and their last lap, best lap.. etc. Completely new to coding but learning the ropes. This is an example of an output from the API.
"Successful": true,
"Session": {
"RunNumber": "47",
"SessionName": "KART DRIVERS - EXPERIENCE / PROVA 11 22:30",
"TrackName": "KGV RACE TRACKS - CIRCUITO 109",
"TrackLength": "0.725",
"CurrentTime": "23:05:24",
"SessionTime": "00:13:27",
"TimeToGo": "00:04:32",
"LapsToGo": "9999",
"FlagStatus": "Green",
"SortMode": "race",
"Classes": {
"1": {
"ClassID": "1",
"Description": "RENTAL"
}
},
"Competitors": {
"018": {
"RacerID": "018",
"Number": "018",
"Transponder": "02",
"FirstName": "LR",
"LastName": "",
"Nationality": "",
"AdditionalData": "",
"ClassID": "1",
"Position": "28",
"Laps": "8",
"TotalTime": "00:12:34.376",
"BestPosition": "26",
"BestLap": "8",
"BestLapTime": "00:01:09.158",
"LastLapTime": "00:01:09.158"
},
"043": {
"RacerID": "043",
"Number": "043",
"Transponder": "48",
"FirstName": "LORENZO",
"LastName": "",
"Nationality": "",
"AdditionalData": "",
"ClassID": "1",
"Position": "32",
"Laps": "5",
"TotalTime": "00:12:54.095",
"BestPosition": "32",
"BestLap": "4",
"BestLapTime": "00:01:38.740",
"LastLapTime": "00:02:39.277"
How would I go about reading data from this api every 30 seconds to 1 minute, and exporting that data into a CSV to put on excel?

Querying/flattening multi-level nested JSON in Cosmos DB when array name is random on one level deep down

I would like to get some help to write a query to get a flat JSON to feed Power BI.
The data store is a Cosmos DB container with JSON. The structure is fixed.
The example JSON stucture is this:
"orderid": "999888777",
"name": "dwayne.johnson",
"mainData": {
"giftData": {
"name": "Rocketship",
"giftDetails": {
"**123456789**": {
"boxInfo": [
{
"name": "Leonardo Da Vinci Big Box",
"city": "London",
"country": "United Kingdom",
"currency": "EUR",
"price": 99.43,
}
],
"colorScheme": [
{
"name": "Red Apple Delight",
"code": "123AAA",
}
],
"CourierInfo": [
{
"name": "UPS",
"code": "BBBA333",
}
],
"orderid": "444333434",
"name": "chris.rock",
"mainData": {
"giftData": {
"name": "Junglemaster XXL",
"giftDetails": {
"**32432423424**": {
"boxInfo": [
{
"name": "Gerba Tool Big O",
"city": "München",
"country": "Germany",
"currency": "EUR",
"price": 103.22,
}
],
"colorScheme": [
{
"name": "Green Mix",
"code": "999DDD",
}
],
"CourierInfo": [
{
"name": "GLS",
"code": "CCCGV3",
}
],
I would like to get to following output:
orderid
currency*
price**
999888777
EUR
99.43
444333434
EUR
103.22
*The path would be giftData.giftDetails.123456789 or 32432423424 or any random.boxInfo.currency
**The path would be giftData.giftDetails.123456789 or 32432423424 or any random.boxInfo.price
The question is how can I select the currency and price info 4 levels deep, when the container array name is a random number (in bold)?
Thank you very much for your time and help!

How to get the admin/creator of a repository using Github REST API v3

I want to get the details of the person who created the repository using Github API. I got the repositories in my organization using:
https://github.example.com/api/v3/search/repositories?q=org:<name>
I got a list of 30 repositories within the organization with details in the following manner:
{
"total_count": 40,
"incomplete_results": false,
"items": [
{
"id": 3081286,
"node_id": "MDEwOlJlcG9zaXRvcnkzMDgxMjg2",
"name": "Tetris",
"full_name": "dtrupenn/Tetris",
"owner": {
"login": "dtrupenn",
"id": 872147,
"node_id": "MDQ6VXNlcjg3MjE0Nw==",
"avatar_url": "https://secure.gravatar.com/avatar/e7956084e75f239de85d3a31bc172ace?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"gravatar_id": "",
"url": "https://api.github.com/users/dtrupenn",
"received_events_url": "https://api.github.com/users/dtrupenn/received_events",
"type": "User"
},
"private": false,
"html_url": "https://github.com/dtrupenn/Tetris",
"description": "A C implementation of Tetris using Pennsim through LC4",
"fork": false,
"url": "https://api.github.com/repos/dtrupenn/Tetris",
"created_at": "2012-01-01T00:31:50Z",
"updated_at": "2013-01-05T17:58:47Z",
"pushed_at": "2012-01-01T00:37:02Z",
"homepage": "",
"size": 524,
"stargazers_count": 1,
"watchers_count": 1,
"language": "Assembly",
"forks_count": 0,
"open_issues_count": 0,
"master_branch": "master",
"default_branch": "master",
"score": 10.309712
}
]
}
The problem I have right now is that the owner's id is always the same and it's equal to the organization name. I want the details of the creators. Is there any way I could do that? I tried searching everywhere, but I couldn't find any solution.

Bigcommerce Stencil Common Product Card Model has_options attribute not working

According to the documentation, there is a has_options attribute on the Common Product Card Model that should return a boolean showing whether or not the product has options.
However, this value is returning false for all of my products, even though they have options. For example, if I access the homepage in debug mode via this url:
http://localhost:3000/?debug=context
One of the products under the featured products section is:
{
"id": 114,
"name": "Product Name",
"url": "http://www.example.com/product-url",
"brand": null,
"rating": 5,
"availability": "Usually ships the next business day",
"summary": "Product summary goes here",
"image": {
"data": "https://cdn2.bigcommerce.com/server2100/abcdef/images/stencil/{:size}/products/114/8086/product_image.jpg?c=2",
"alt": ""
},
"date_added": "January 6, 2014",
"qty_in_cart": 0,
"pre_order": false,
"has_options": false,
"show_cart_action": false,
"add_to_wishlist_url": "/wishlist.php?action=add&product_id=114",
"price": {
"without_tax": {
"formatted": "$19.99",
"value": 19.99
},
"rrp_without_tax": {
"formatted": "$24.99",
"value": 24.99
},
"saved": {
"formatted": "$5.00",
"value": 5
},
"tax_label": "Tax"
}
}
As you can see has_options is false. However, this product does have options. Via the control panel, I can see that it has a color swatch option. I can also see this by navigating to the products page in debug mode at http://localhost:3000/product-url?debug=context. As you can see, part of the output contains the options information for that product:
"options": [
{
"id": 498,
"type": "Configurable_PickList_Swatch",
"display_name": "Color",
"required": true,
"condition": true,
"values": [
{
"label": "Powder Coat Black",
"id": 390,
"data": [
"000000"
],
"selected": false
},
{
"label": "Anodized Aluminum",
"id": 391,
"data": [
"D9D9D9"
],
"selected": false
}
],
"partial": "swatch"
}
],
As you can see, the product does in fact have options, yet the Common Product Card Model for this product shows has_options as false.
Is there some other setting that is effecting the output of has_options? Why would it be showing false for a product that has options?
has_options is used to denote something is purchasable (true) or not (false). This is misleading and documentation will be revised to reflect this.