How do I retrieve quoteIds for specific client(customer) in Smart Quotes? - api

I am trying to retrieve a list with all quote ids for a specific customer.
It seems there is no API operation for Quotes(Smart)(v2) in Home Portal Api documentation to perform that, only retrieving details for a given quote:
GET /v2/quotes/{quoteId}
Is it possible for this operation to be added?

Have a view defined in the Home Portal that produces a list of all
quotes with their ids for your client.
Learn the view's id.
Use Browser method to retrieve the quotes list.

Related

Is it okay to return all data that related to the resource in one endpoint

We have a recipe in our mobile application, this recipe has a details screen and the details screen has a lot of information, for example:
Rating
Related recipes
Ingredients
Recipe info
Nutritional info
So is that right to return all this info in the same endpoint or create multiple endpoints for each section?
One endpoint example:
GET: https://www.example.com/api/v1/{recipeId}
Multiple endpoints example:
GET: https://www.example.com/api/v1/{recipeId}/info // this API will return all info including the ingredients
GET: https://www.example.com/api/v1/{recipeId}/rating
GET: https://www.example.com/api/v1/{recipeId}/related
GET: https://www.example.com/api/v1/{recipeId}/nutritional
It depends.
If a consumer of your API is say a web page where you want to display all the information at the same time in one click, you can just bring all information together and display in one go rather than calling APIs one by one and then aggregating, however if there is possibility that individual endpoints are also required to be called separately, then you can expose multiple endpoints.
Also,your resource uri should be like this :
/api/v1/recipes/{recipeId}
In this case, you can create a single API endpoint. And, can expose a query parameter which shows which are the fields user (rest client, web) is interested in.
/api/v1/recipes/{recipeId}/?fields=all
/api/v1/recipes/{recipeId}/?fields=info,rating,related
/api/v1/recipes/{recipeId}/?fields=info
In this way, you will be saved from the headache of writing multiple endpoints for a single serving type.
Also, the schema of output message or JSON will be the same.
Maybe in future, you want to add another field to your response. You just need to add another filter name. Your client (web/rest) doesn't need to use a new API for that. Just pass the new filter and done.

Square Connect CatalogObjectId

I'm developing an ASP.Net (C#) website for a brick and mortar business that uses Square as their POS. I'm trying to use the Square Checkout API. In creating the CreateOrderRequestLineItem, I need to set the CatalogObjectId of the item so that web sales/activity will reconcile to their in-person sales for those same items. I am not able to locate the CatalogObjectId on the square dashboard and I really don't want to make a call to the catalog API to hopefully get the correct item that the user has already selected the item. I've exported the list of items from the dashboard and I see a "token" column that looks like it might be a unique ID. Basically, I have two questions:
Is the token value from the export the CatalogObjectId?
If no, then how/where can I get the CatalogObjectId for a given item?
Thanks.
Here are my answers -
No, Token value is not the CatalogObjectId
You can save the catalog items in your DB by calling "ListCatalog" api as -
https://docs.connect.squareup.com/api/connect/v2#endpoint-listcatalog
and then get CatalogObjectId by comparing the product names.
Don't know how it was in 2018 but I just used the token value as the catalog_object_id and it seems to work fine.
From this url:
https://squareup.com/dashboard/items/library
Click "Actions" and select Export Library as .xls format.
First column in the spreadsheet is token and you can use those values as the catalog_object_id's

How do make an external API call from a Podio App field?

I have a location field called origin and a field called distination. I am trying to calculate a third field called distance by using an address from both the Origin and the Destination field? What is the easiest way to achieve this?
Here's one idea. Use the Google map's destination API to get the distance between between the 2 location fields. I am not sure how I can make these 2 API calls.
Sorry, but I don't think that's currently possible within Podio. I tried to get this to work using Podio's Calculation field and Google's Distance Matrix service. Unfortunately, the Calculation field doesn't allow access to the XMLHttpRequest API, which is what you would likely need to access any 3rd-Party APIs.
You need to use a third party tool to calculate the distance. Then update a number field (or maybe text field depending on your need) in Podio with the result. The calculation field cannot be use for such purposes.

Possible to fetch full hierarchical requirements in single portfolio item web service call?

I'm trying to aggregate some information about the kanban states of my user stories. If query a PifTeam item, I get a summarized collection of UserStories associated with it.
Example query:
https://rally1.rallydev.com/slm/webservice/1.40/portfolioitem/pifteam/99999999999.js
However I then have to run a loop on the UserStories collection, individually querying each one to get at the information I need. This potentially results in a lot of web service calls.
Is there a way to return the full hierarchical requirement information in the original pifteam query so that there is only one webservice call which returns all sub-objects? I read the webservice api and was trying to play with the fetch parameter but had no success.
This functionality will be disabled in WSAPI 2.0 but will continue to be available in the 1.x versions. That said, you should be able to use a fetch the fields on story that you need like this:
/pifteam/9999.js?fetch=UserStories,FormattedID,Name,PlanEstimate,KanbanState
Fetch will hydrate the fields specified on sub objects even if the root object type doesn't have those fields. So by fetching UserStories the returned collection will populated with stories, each having the FormattedID, Name, PlanEstimate and KanbanState fields included.
There is no way to do it from Rally's standard Web Services API (WSAPI) but you can from the new Lookback API (LBAPI). The query would look something like this:
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/<ObjectID_for_Workspace>/artifact/snapshot/query.js?find={__At:"current",_TypeHierarchy:"HierarchicalRequirement",Children:null,_ItemHierarchy:<ObjectID_for_PortfolioItem>}&fields=["Name"]
Fill in the ObjectIDs for your Workspace and PortfolioItem. The _ItemHierarchy field will cross work item type boundaries and goes all the way from PortfolioItems down through the Story hierarchy down to Defects and even Tasks, so I added _TypeHierarchy:"HierarchicalRequirement" to limit it to Stories. I have specified Children:null which means you'll only get back leaf Stories. The __At:"current" clause get's the current tree and values. Remember, it's the "Lookback" API, so you can retrieve the state of the object at any moment in history. __At:"current" says to get the current values and tree.
Note, the LBAPI is delayed from current values in the system by anywhere from seconds to minutes. Typically it's about 30 seconds behind. You can see how far behind it is by checking the ETLDate field in the response.
Details about the LBAPI can be found here. Note, that the LBAPI is available in preview now for almost all Rally customers. There are still a number of customers where it is not yet turned on. The best way to tell if it's working for your subscription is to try the query.

flickr API, getClusterPhotos with license filter

I am getting a collection of photos via this flickr API:
description: http://www.flickr.com/services/api/flickr.tags.getClusterPhotos.html
example: http://www.flickr.com/services/api/explore/flickr.tags.getClusterPhotos
I see no option to include the license parameter on the API query and I thus get copyrighted images returned, which I do not want. I see that I can get the license info by calling flickr.photos.getInfo on each individual image, but this will be quite time consuming. Are there any other methods to get a collection of photos from a tag cluster with a particular license?
License is one of the parameters listed in their api here:
http://www.flickr.com/services/api/flickr.photos.search.html
I would try just using the id's from the results listed here in their return:
http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html
for example:
&license=4
It may be better to use "flickr.photos.search" instead. You can search for a specific tag and license (there is no need to do a second call on each image).
https://www.flickr.com/services/api/explore/flickr.photos.search