#StackBounty: #sharepoint-online #rest #download download partial by using GetFileById sharepoint REST-API

Bounty: 100

I want to download only a part of a file using the ‘GetFileById’ SharePoint REST api but I don’t not see any references in the documentation about support for partial file download.

I tried using HTTP ‘Range’ header (Adding to the HTTP headers the following header: 'Range': 'bytes=0-1023'), but it still downloaded the entire file. Also, when I received the file, I did not see ‘Accept-Ranges’ as part of the server’s answer, which also makes me believe it is not supported.

Does someone know if this feature is supported and in this case how it can be implemented?

If it makes any difference for the answer, I am using SharePoint Online.


Get this bounty!!!

#StackBounty: #rest #http #asynchronous #websocket #sinatra Sinatra using a websocket client to respond to a http request

Bounty: 50

I am writing a web server that I would like to be RESTful, but the thing is that it has to interact with another server that communicates exclusively via web sockets. So, this needs to happen:

  1. A request comes into my Sinatra server from a client
  2. My server opens a web socket to the foreign server
  3. My server asynchronously waits for messages and things from the foreign server until the socket is closed (this should only take two hundred or so milliseconds)
  4. My server sends back a response to client

I’m sure this is not too complicated to accomplish, but I’m a bit stuck on it. What do you think? A simplified version of what I’ve got is below.

require 'sinatra'
require 'websocket-client-simple'

get '/' do
     ws = WebSocket::Client::Simple.connect(' ws://URL... ')

     ws.on :message do
          puts 'bar'
     end

     ws.on :close do
          # At this point we need to send an HTTP response back to the client. But how?
     end

     ws.on :open do
          ws.send 'foo'
     end

end


Get this bounty!!!

#StackBounty: #rest #serenity-js Serenity + Rest services

Bounty: 50

I am trying to demo serenity woth Restassured at my workplace here and show them how awesome and easy it is to use in comparisin to using jasmine.js
How ever I am stuck with few things in teh basic test I am trying to do
My test says

Given we have valid credentials for the client using this test
  When we try to serach for a medicine '<medicine>' 
  Then we get a valid '<perfLabel>' response with search results
  |medicine|perflabel|
  |Salbutamol|perflabel1|
  |Panadol|perflabel2|
  |Salbutamol (GA)|perflabel3|

When I go into the next step

@When("we try to serach for a medicine '(.*)' ")
    public void tryToSearchUsingEquals(String medicine)
    {
    tsApiActions.requestServiceSearchWhichEquals(medicine);
    }


In my Step method



@Step
  public void requestServiceSearchWhichEquals(String medicine)
  {
  host = "http://www.int.healthdirect.gov.au/api/cs/v1/terminology-service/trade-product/search-summary?offset=0&limit=20&prefLabel=eq "+medicine+"&sort=prefLabel DESC&cache=false";

  requestSend(host); 
  }

The questions I have are

  1. How do i inject the variables(Salbutamol, Panadol) into the uri?
  2. How do I put this URI into a seperate properties file and call it in the Step method?

Any help is really appreciated
Thanks


Get this bounty!!!

#StackBounty: #magento2 #customer #rest #session Customer session for for logged in customer by token based authentication

Bounty: 50

We are using token based authentication over rest api from that resource

/rest/V1/integration/customer/token?username=USER_NAME&password=P@$$WORD

to consume magento rest api web services.

We get tokens and return customer details successfully form that resource

/rest/V1/customers/me

I need to get the customer ID from his session but I can not because user always considered not logged in, despite working fine for web scenario below is the code snippet I use.

   public function __construct(MagentoCustomerModelSession $session){

    parent::__construct($context);
    $this->customerSession = $session;
}

I am facing that problem inside my custom offline payment method defined in custom extension, I need to know the customer ID in order to determine if the customer can use that payment method or not.

Even if I tried to use the checkoutSession, still can not get the customerId.

$om = MagentoFrameworkAppObjectManager::getInstance();
    $checkoutSession = $om->get('MagentoCheckoutModelSession');
    exit(var_dump($checkoutSession->getQuote()->getCustomer()->getId())); //return NULL

The custom extension works fine when viewing the store from the browser.

Can you please help me what is wrong here?

Thanjs in advance


Get this bounty!!!

#StackBounty: #java #spring #rest #apache-camel #resttemplate REST service call with Camel which requires authentication api called first

Bounty: 50

Camel has to call REST service for some integration, However, the REST service has one authentication api (POST api) which needs to be called first to get a token and then other subsequent api calls has to be invoked with the token embedded in header of HTTP requests.

Does Spring Restemplate or apache camel has some api to support the same?


Get this bounty!!!

#StackBounty: #php #mysql #database #rest #codeigniter Create API endpoint for fetching dynamic data based on time

Bounty: 50

I have a scraper which periodically scrapes articles from news sites and stores them in a database [MYSQL].
The way the scraping works is that the oldest articles are scraped first and then i move onto much more recent articles.

For example an article that was written on the 1st of Jan would be scraped first and given an ID 1 and an article that was scraped on the 2nd of Jan would have an ID 2.

So the recent articles would have a higher id as compared to older articles.

There are multiple scrapers running at the same time.

Now i need an endpoint which i can query based on timestamp of the articles and i also have a limit of 10 articles on each fetch.

The problem arises for example when there are 20 articles which were posted with a timestamp of 1499241705 and when i query the endpoint with a timestamp of 1499241705 a check is made to give me all articles that is >=1499241705 in which case i would always get the same 10 articles each time,changing the condition to a > would mean i skip out on the articles from 11-20. Adding another where clause to check on id is unsuccessful because articles may not always be inserted in the correct date order as the scraper is running concurrently.

Is there a way i can query this end point so i can always get consistent data from it with the latest articles coming first and then the older articles.

EDIT:

   +-----------------------+
   |   id | unix_timestamp |
   +-----------------------+
   |    1 |   1000         |
   |    2 |   1001         |
   |    3 |   1002         |
   |    4 |   1003         |
   |   11 |   1000         |
   |   12 |   1001         |
   |   13 |   1002         |
   |   14 |   1003         |
   +-----------------------+

The last timestamp and ID is being sent through the WHERE clause.

E.g.
$this->db->where('unix_timestamp <=', $timestamp);
$this->db->where('id <', $offset);
$this->db->order_by('unix_timestamp ', 'DESC');
$this->db->order_by('id', 'DESC');

On querying with a timestamp of 1003, ids 14 and 4 are fetched. But then during the next call, id 4 would be the offset thereby not fetching id 13 and only fetching id 3 the next time around.So data would be missing .


Get this bounty!!!

#StackBounty: #magento2 #rest Magento2: Save Product Data for global scope using Rest API

Bounty: 50

I am trying to add product using Rest API. Adding product is working fine.

But I am facing issue in assign in the product informtaion only for Default values instead of coying data for store view. When we select store view Use Default Value checkbox must be checked. Only one attribute value must save in database with scope 0 instead of copying same values for each store.

How can I acheive the above scenario using Rest API ? Below is what I have tried so far:

Case 1:

I tried to call API using the below URL, But It replicate the product values for store view.

POST   /rest/V1/products

Case 2:

I tried to call API using the below URL, But It also replicate the product values for store view.

POST   /rest/{store_code}/V1/products

Case 3:

I tried to call API using the below URL

POST   /rest/all/V1/products

using the above website not assigned to product. so I called catalogProductWebsiteLinkRepositoryV1 to assign product in website as below, but it also replicate the product values for store view.

POST   /rest/V1/products/{sku}/websites

Please suggest how can we save product data for global scope only ?

Note: only have one website, one store and one store view in magento installtion.


Get this bounty!!!

#StackBounty: #8 #rest CSRF token time life

Bounty: 50

I’ve get CSRF token from url /rest/session/token. After have CSRF token, I can send request (get, post) to API and working fine. But after time, when I send request. It’s doesn’t work. I’m getting error permission denies. I think maybe CSRF token expire time. So I want know time life of CSRF token. And how to change time life of CSRF token.


Get this bounty!!!

#StackBounty: #rest #onedrive #onedrive-api Downloading and Moving OneDrive files from shared link directory

Bounty: 100

I am looking for assistance to find out how I can download and move a OneDrive file that is accessed through a shared directory, via the shared link method of sharing.

I have two users:

  • user ‘A’ who is a Microsoft Consumer and has a regular OneDrive account and will host a csv file ‘test.csv’ in a folder ‘toshare’
  • and user ‘B’ who is also a regular Microsoft Consumer who should use the graph API to download test.csv and then move the file to a subdirectory /toshare/archive

Aside: I am currently using the chrome app “advanced REST client” to manually make the REST calls, and am getting Authenticated OAuth BEARER tokens by inspecting network traffic from Microsoft’s online “Graph Explorer” tool. After we understand the calls, we’ll integrate it into our Java app.

I have succesfully followed the instructions here:
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/shares_get
to view the folder contents.

To be more explicit, user ‘A’ has went into OneDrive and has right clicked the folder ‘toshare’ and selected shareLink. I have converted the shareLink to a share token and then used the following API call with the Graph API as user ‘B’:

GET https://graph.microsoft.com/v1.0/shares/<share-token>/root?$expand=children

this shows me all the files in the directory, which includes ‘test.csv’

Now, using this information, how can I download test.csv? Assuming user ‘B’ doesn’t know the name of the file, but can identify it by being a .csv file (we can do this in code). There does not appear to be much documentation on how to download the files through a share.

The closest I’ve gotten was to take the “webUrl” attribute of the children object for my file, and then turn that into a share token and call

GET https://graph.microsoft.com/v1.0/shares/<child-share-token>/root

This will show me the file meta-data. and then I try to download it by roughly following the api documentation to download https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/item_downloadcontent

GET https://graph.microsoft.com/v1.0/shares/<child-share-token>/root/content

This is interesting because this works if I make the call with user ‘A’ but does not work for user ‘B’ who instead gets a 403 in advanced REST client. (If I run it in Graph Explorer, I get “The site in the encoded share URI is invalid.” instead, which I’ve discovered with other experimentation, really means there’s an authorization issue.)

At this point I’m rather stuck. After downloading the file, I also would like to move it into a subdirectory, denoting that it has already been read in. I’d also like to get this working for OneDrive for Business, but that seems to be another set of challenges that I’ll leave for another day.

Any insight would be great thanks,
Jeremy


Get this bounty!!!

#StackBounty: #magento-2.1 #api #rest #search #solr Magento Integration with Solr

Bounty: 50

I have integrated Solr with Magento EE. Solr logs whatever I search in Magento fronted search box.

I’d like to know if Magento will also use Solr engine if the search REST API is called?


Get this bounty!!!