Akamai Media Services Live Api: limit results from stream query - akamai

I am trying to get a list of our streams from Akamai's Media Services API v1; however, I'm only getting a 504 Gateway Timeout. I believe this is due to the amount of streams being queried for, as I can get a single stream when I give the ID for the GET stream/{streamId} endpoint.
I am using the edgegrid node module and have tried adding query parameters such as limit, pageSize/page-size, and stream-name/streamName to limit my results to no avail.
Is there a way to limit the results in a query for this API?
edit:
We are using v1 of the API

If you're using v2 of the API, it should automatically return the results paged. The API endpoint /config-media-live/v2/msl-origin/streams includes the ability to specify query string parameters page and pageSize. page is an integer that tells the API which page number to return. pageSize is also an integer referring to the number of entries the page should contain.
Example: /config-media-live/v2/msl-origin/streams?page=2&pageSize=10&sortKey=createdDate&sortOrder=ASC

Related

Hasura on Google Cloud Run - Monitoring

I would like to have a monitoring on my Hasura API on Google Cloud Run. Actually I'm using the monitoring of Google Cloud but It is not really perfect. I have the count of 200 code request. But I want for example, the number of each query / mutation endpoint request.
I want :
count 123 : /graphql/user
count 234 :/graphql/profil
I have :
count 357 : /graphql
If you have an idea.
Thanks
You can't do this with GraphQL unfortunately. All queries are sent to the /v1/graphql endpoint on Hasura, and the only way to distinguish the operations is by parsing the query parameter of the HTTP request and grabbing the operation name.
If Google Cloud allows you to query properties in logs of HTTP requests, you can set up filters on the body, something like:
"Where [request params].query includes 'MyQueryName'"
Otherwise your two options are:
Use Hasura Cloud (https://hasura.io/cloud), which gives you a count of all operations and detailed metrics (response time, variables, etc) on your console dashboard
Write and deploy a custom middleware server or a script for a reverse proxy that handles this

Get all items in DynamoDB with API Gateway's Mapping Template

Is there a simple way to retrieve all items from a DynamoDB table using a mapping template in an API Gateway endpoint? I usually use a lambda to process the data before returning it but this is such a simple task that a Lambda seems like an overkill.
I have a table that contains data with the following format:
roleAttributeName roleHierarchyLevel roleIsActive roleName
"admin" 99 true "Admin"
"director" 90 true "Director"
"areaManager" 80 false "Area Manager"
I'm happy with getting the data, doesn't matter the representation as I can later transform it further down in my code.
I've been looking around but all tutorials explain how to get specific bits of data through queries and params like roles/{roleAttributeName} but I just want to hit roles/ and get all items.
All you need to do is
create a resource (without curly braces since we dont need a particular item)
create a get method
use Scan instead of Query in Action while configuring the integration request.
Configurations as follows :
enter image description here
now try test...you should get the response.
to try it out on postman deploy the api first and then use the provided link into postman followed by your resource name.
API Gateway allows you to Proxy DynamoDB as a service. Here you have an interesting tutorial on how to do it (you can ignore the part related to index to make it work).
To retrieve all the items from a table, you can use Scan as the action in API Gateway. Keep in mind that DynamoDB limits the query sizes to 1MB either for Scan and Query actions.
You can also limit your own query before it is automatically done by using the Limit parameter.
AWS DynamoDB Scan Reference

Is it possible to request Instagram metrics with different periods in a single API call?

I would like to request the following Instagram Insights metrics using a single graph API call:
follower_count
audience_gender_age
The problem I am facing is that follower_count requires a period parameter 'day' and audience_gender_age a period parameter 'lifetime'. I have tried to merge them in a single API call, but this is not supported by Facebook:
/XXXXXX/?fields=insights.metric(follower_count).period(day),insights.metric(audience_gender_age).period(lifetime)
I there a proper way to request these metrics using different periods in a single API call?
If you need to request data from the same field twice in one query, that can be done using the .as(name) aliasing syntax, https://developers.facebook.com/docs/graph-api/aliasing-fields
Quote docs,
For example, you can retrieve an image in two sizes and alias the returned object fields as picture_small and picture_larger:
me?fields=id,name,picture.width(100).height(100).as(picture_small),
picture.width(720).height(720).as(picture_large)

How to Access Object From Amazon s3 using getSignedUrl Operation

How to Access Object From Amazon s3 using getSignedUrl Operation
I`m able to generate Signed url using getSignedUrl method.
var url = s3.getSignedUrl('getObject', paramsurl);
using this url can i access full object from s3? i make http request but its only return 1000 as xml response. how to find next set of Objects and push to new array?
Your questions appears to be related to how many S3 objects are returned in a single ListObjects call.
If so, when you call the underlying APIs that list AWS resources, the API will typically return, by default, 1000 items. It will also return a 'next token' that you can use in a subsequent call to the same API to return the next batch of items.
Sometimes, you can also specify a 'max items' or 'max keys' in your request to allow you to override the default of 1000.
PS if you use the AWS SDKs then this batching of results is typically hidden from you.

How do I set the cache key for the AWS API Gateway?

I have a Lambda function that is mapped to a HTTP endpoint using the AWS API Gateway. This works fine, I have mapped query string params to the Lambda event, everything works:
https://api.buzzcloud.xyz/?count=999
Which I can call from http://buzzcloud.xyz
I would like to enable caching, but it seems that by default the API Gateway uses the URL for caching, and so changes in my query string parameters are not triggering a different cache result.
The result is that with caching on, my page returns whatever data was first requested and put in the cache.
How do I set a custom cache key or ensure querystring is part of the cache identifier?
Turns out the is a not-so-secret setting that I totally missed that allows for the exact query string params that should be used for the cache to be set.