SoftLayer API Product_Package 200 getItemPrices returns mulitple (including invalid) priceIds for the same location group issueGrouID - api

I use the following API to get item price for item id=4281, 4.00 TB SATA disk
https://api.softlayer.com/rest/v3/SoftLayer_Product_Package
/200/getItemPrices?objectMask=mask[item,id,
locationGroupId,hourlyRecurringFee,recurringFee]&objectFilter={itemPrices:
{item:{id:{operation:*=4281}}}}
It gives two priceIds for the each same location group including invalid priceIds.
itemId=4281, locationGrouID=545, priceId=57241,68071
itemId=4281, locationGrouID=503, priceId=66971, 68063
itemId=4281, locationGrouID=505, priceId=68065, 68605
itemId=4281, locationGrouID=507, priceId=68067, 57009
itemId=4281, locationGrouID=583, priceId=153059,153159
itemId=4281, locationGrouID=509, priceId=68069,57131
itemId=4281, locationGrouID="", priceId=21209,21211
Can somebody please fix this API to make it return only single valid priceId for different locationGrouID ?
Thanks.

There is no issue the prices are different from each other, for example:
priceId=57241,68071
the priceId "57241" is valid for all disk (disk1,disk2,etc) except for the disk0, which means that you cannot use this price for the disk0 of your server. The priceId "68071" is valid only for the disk0.
The same behavior is for all the prices that you listed. In order to know which price is valid for what kind of disk you need to see the categories of the price. Try this request and you will see the categories:
https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/200/getItemPrices?objectMask=mask[categories,item,id, locationGroupId,hourlyRecurringFee,recurringFee]&objectFilter={"itemPrices": {"item":{"id":{"operation":"*=4281"}}}}
Regards

Related

SupplyCategoryUnavailable - what does this FBAOutboundServiceMWS error mean?

We have a script for submitting Amazon FBA orders via FBAOutboundServiceMWS, using CreateFulfillmentOrder request.
Orders for some products cannot be placed, we are getting this error:
<ErrorResponse xmlns="http://mws.amazonaws.com/FulfillmentOutboundShipment/2010-10-01/">
<Error>
<Type>Sender</Type>
<Code>InvalidRequestException</Code>
<Message>Value SupplyCategoryUnavailable for parameter MerchantSku is invalid.</Message>
</Error>
<RequestId>22dafce7-7457-4232-b994-efea4f386dca</RequestId>
</ErrorResponse>
There is no information about it in a documentation, and we do not see any difference between products which experience the issue and products which do not.
As it turned, those were SKUs called SNL – small and light program with amazon.com.
Below an answer from Amazon customer support which we have received:
Please confirm with if the items meet these conditions:
Weigh less than or equal to 8 ounces
Have dimensions less than or equal to 9x6x2 inches
Priced under $10
If the above mentioned conditions are met you have to do it manually

MuleSoft: Sum line items and group by ID

I am new to integration and MuleSoft so I need your help. I have a flat file with different invoice line items per salesID, like this:
SalesOrderID OrderQty UnitPrice
43659 70 2024.994
43659 70 2024.994
43660 1 419.4589
43660 1 874.794
43661 1 809.76
I want to insert total invoice amount and quantity in another CSV file using Mule, something like this:
SalesOrderID OrderQty UnitPrice
43659 140 4049.988
43660 2 1294.4589
43661 1 809.76
I know how to do this in informatica,but im trying to figure out a way to do this in MuleSoft. How can I sum up all the line items and group them by SalesOrderID? Any help/clue will be really appreciated.
Thanks.
There are a number of ways to do this, let me explain my personal favourite assuming you are using Mule community edition.
Use the superb library: SuperCSV, it will allow you not only to parse the data (including those dot numbers) but also validate it and give back an exact report on why the file is broken in case it is.
This could be done in a transformer that transform the inbound stream and return either a map of maps (or even better a iterator that handles the whole thing but this is more difficult) or a custom exception with the error report.
Given that this requirement is one that faces Mule developers even today, it's useful to see a solution based on the Mule 4.x runtime and Dataweave 2.x.
If the data came from a file or is otherwise a monolithic stream of text, use the splitBy() function to get an array of text lines.
payload splitBy '\n'
remove the first line as the headers should not be calculated
payload[1 to -1] // this is my favorite way to do it
Now use the reduce() function to iterate over each of the lines in turn, updating the accumulator each time to account for quantity and price.
Hopefully that helps

eBay API aspectFilter with MaxPrice parameter returns 0 results

I am using the following URL to fetch car listing. But when I add the MaxPrice parameter It shows 0 items. But on the site there are 12 items that have price below my value.
http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.12.0&SERVICE-NAME=FindingService&SECURITY-APPNAME=prosoftda-d112-4c99-9bec-8a09c902a7a&RESPONSE-DATA-FORMAT=JSON&paginationInput.entriesPerPage=50&categoryId=6001&outputSelector=PictureURLSuperSize&REST-PAYLOAD=true
&aspectFilter(0).aspectName=Make&aspectFilter(0).aspectValueName=Audi
&aspectFilter(1).aspectName=Model&aspectFilter(1).aspectValueName=Q7
&aspectFilter(2).aspectName=Model+Year&aspectFilter(2).aspectValueName=2013
&aspectFilter(3).aspectName=MaxPrice&aspectFilter(3).aspectValueName=50000.00
When I remove MaxPrice parameter the URL works perfectly.
Btw, I got the solution for this question:
To pass the price value need to pass as ItemFilter. not with the AspectFilter.
I replace the string :
&aspectFilter(3).aspectName=MaxPrice&aspectFilter(3).aspectValueName=50000.00
By the string :
&itemFilter(0).name=MaxPrice&itemFilter(0).value=500000.00
So It works now. As Price parameter is related to attribute so need to pass with the ItemFilter.
So final URL Is:
http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.12.0&SERVICE-NAME=FindingService&SECURITY-APPNAME=prosoftda-d112-4c99-9bec-8a09c902a7a&RESPONSE-DATA-FORMAT=JSON&paginationInput.entriesPerPage=50&categoryId=6001&outputSelector=PictureURLSuperSize&REST-PAYLOAD=true
&aspectFilter(0).aspectName=Make&aspectFilter(0).aspectValueName=Audi
&aspectFilter(1).aspectName=Model&aspectFilter(1).aspectValueName=Q7
&aspectFilter(2).aspectName=Model+Year&aspectFilter(2).aspectValueName=2013
&itemFilter(0).name=MaxPrice&itemFilter(0).value=500000.00
Thanks. may be this can help someone who is finding the same question.
I have no experience with this API so this is just a shot in the dark. But I found this link:
http://developer.ebay.com/DevZone/finding/CallRef/findItemsAdvanced.html
From what Ive read within that MaxPrice is more of an "itemFilter" (things such as maxPrice, bestOfferOnly, featuredSeller) than an "aspectFilter" (things such as Make, Model, Optical Zoom).
Further down it also states that some itemFilters need a paramName, such as maxPrice
For example, if you use the MaxPrice itemFilter, you will need to specify
a parameter Name of Currency with a parameter Value that specifies the type
of currency desired.
Again never used this API but seems relevant to me.

Facebook Application that Searches for nearest Place

Is it possible to create a facebook application that would display a list of the nearest place of interest location?
Much like the current existing Urbanspoon Application (http://www.urbanspoon.com/c/338/Perth-restaurants.html) but on facebook.
Can somebody please point me to the right direction :)
Get place ID for user's current location:
SELECT current_location FROM user WHERE uid=me()
Get coordinates for that place ID:
https://graph.facebook.com/106412259396611
Get nearby places:
https://graph.facebook.com/search?type=place&center=65.5833,22.15&distance=1000
You could of course get the latitude and longitude by other means.
I know this is a resolved post, but i've also been doing some work on this and thought I'd add my findings / advice...
Using the FQL:
SELECT page_id, name, description, display_subtext FROM place WHERE distance(latitude, longitude, "52.3", "-1.53333") < 10000 AND checkin_count > 50 AND CONTAINS("coffee") order by checkin_count DESC LIMIT 100
This will get pages containing the word "coffee" in their title, description or meta-data that are within 10k of the specified lat/lon.
"page_id": 163313220350407,
"name": "Starbucks At Warwick Services, M40",
"display_subtext": "Coffee Shop・Service Station Supply・3,012 were here"
I like to set a min check-in count of around 50 to help filter out the ad-hoc places that single users create such as "the coffee machine at jim's house". This helps ensure better quality and relevancy of returned results.
Hope this helps someone.

Foursquare Venue API & Number of Results, in a more efficient way?

I'd like to ask if there is a more efficient way to get more than 50 results besides these options?
How do I get more locations?
Foursquare Venue API & Number of Results
and this, which is for the old API Foursquare API nearByVenue service issue
I'm using the current foursquare api for the venue search https://developer.foursquare.com/docs/venues/search .
What I'd like is something like an offset option, in order to get more results, but it seems that there isn't such an option.
Is there an alternative solution?
Thank you in advance.
you should use venues explore with offset and limit as paramters,
venues explore gives you totalResults and you can use this response to calculate number of pages you need in paginate
for example assume totalResults is 90(pay attention at offset and limit parametr value )
in first request:
https://api.foursquare.com/v2/venues/explore?client_id=client_id&client_secret=client_secret&v=20150825&near=city_name&categoryId=category_id&intent=browse&offset=0&limit=30
in second request:
https://api.foursquare.com/v2/venues/explore?client_id=client_id&client_secret=client_secret&v=20150825&near=city_name&categoryId=category_id&intent=browse&offset=30&limit=30
in third request:
https://api.foursquare.com/v2/venues/explore?client_id=client_id&client_secret=client_secret&v=20150825&near=city_name&categoryId=category_id&intent=browse&offset=60&limit=30
for 90 results you can get all records with above three request
There is actually another option not mentioned here (not pagination though)
Using the (experimental?) categoryId filter.
You can search for a single point (ll) a few times with different category ids, giving you many results (some duplicates as venues can have more than one category).
So you can search for 'Food' venues and 'Nightlife' venues at the same place, getting 100 results in stand of 50.. as said it is 100 results, but not unique results, could be duplicates. I think that is more efficient then trying to play around with the browse radius thing.
Not pagination, but will give a lot more results than a normal search - usually enough even in urban areas.
But yea, having some sort of way to extract more than 50 on a single point is not possible, but could be nice :)
Afraid not. Currently there is no pagination, in order to find more venues you need to move your search area around as in the answers you highlighted. I agree, pagination would be handy though!
For the explorer endpoint this worked for me: If the maximum number of results that is returned for instance is 100, just use offset=100 in the next call which gives you the next 100 results starting from 100 (the offset). Iterate (e.g. using while loop) and keep increasing offset by 100 until you reach the total number or results (which is returned in in the api for totalResults).
My first stack overflow post, tried to answer as clearly as possible
def getNearbyVenues(neighborhoods, latitudes, longitudes, radius=500,ven_num=300):
venues_list=[]
for name, lat, lng in zip(neighborhoods, latitudes, longitudes):
i=0
while (i < ven_num+50):
url = 'https://api.foursquare.com/v2/venues/explore?&client_id={}&client_secret={}&v={}&ll={},{}&radius={}&offset={}&limit={}'.format(
CLIENT_ID,
CLIENT_SECRET,
VERSION,
lat,
lng,
radius,
i,
LIMIT)
# make the GET request
results = requests.get(url).json()['response']['groups'][0]['items']
# return only relevant information for each nearby venue
venues_list.append([(
name,
lat,
lng,
v['venue']['name'],
v['venue']['location']['lat'],
v['venue']['location']['lng'],
v['venue']['categories'][0]['name']) for v in results])
i=i+50
nearby_venues = pd.DataFrame([item for venue_list in venues_list for item in venue_list])
nearby_venues.columns = ['Neighborhood',
'Neighborhood Latitude',
'Neighborhood Longitude',
'Venue',
'Venue Latitude',
'Venue Longitude',
'Venue Category']
print('Ok')
return(nearby_venues)
the code above has worked perfectly with me, where ven_num variable is the desired limit for calling venues in a certain neighborhood